1. 程式人生 > >git push 報錯"Updates were rejected because the tip of your current branch is behind"

git push 報錯"Updates were rejected because the tip of your current branch is behind"

在Android原始碼的修改過程中,在把本地的分支push到伺服器的時候遇到如下錯誤:

error: failed to push some refs to '[email protected]:/home/wsq/Extend/wsq/android/sprd/src/sc7731/android6.0/sc7731_m'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

情景:

當時,手上又一個客戶需求比較多的專案一個人忙不過來,就幾個同事一起來做。我先把我最新的修改push到伺服器,此時的節點為:節點1。其他的同事在將我上傳的分支checkout到自己本地進行修改,修改完成後他第一時間把他的程式碼push到了服務期。好了,當我修改完成後想將我本地的程式碼(我修改的地方和同事的修改沒有衝突)傳到伺服器和同事修改的程式碼合併,我首先git pull了下,沒有什麼異常。但是當我git push origin HEAD的時候系統就提示“Updates were rejected because the tip of your current branch is behind”。

原因:

出現這個錯誤提示原因很簡單,也就是一個先後順序關係。

解決辦法:

1、在你本地重新建立一個分支:git branch test (基於你要提交的分支)

2、在將你要git push的分支git  checkout 到情景中提到的節點1

3、git pull 將你同事的提交全部拉到本地

4、再使用git cherry-pick從test分支將你的修改逐條的提交拉回來

5、然後在使用git push origin HEAD將你的分支push到伺服器

相關推薦

git push "Updates were rejected because the tip of your current branch is behind"

在Android原始碼的修改過程中,在把本地的分支push到伺服器的時候遇到如下錯誤: error: failed to push some refs to '[email protect

Git提交失敗之 Updates were rejected because the tip of your current branch is behind

錯誤顯示 D:\devworkspace\ecpphoton\jcodef>git push To https://github.com/osxm/jcodef.git ! [rejected] master -> master (non-fast-forward)

GitUpdates were rejected because the tip of your current branch is behind

使用git的過程中有時候會出現無法push的問題,報錯如下圖: 這是由於遠端repository和我本地的repository衝突造成,通常發生在多人協作的開發過程中 解決方法: 1.使用強制push的方法: git push -u origin

hint: Updates were rejected because the tip of your current branch is behind資訊 )

在github庫中手動添加了readme檔案,本地執行命令: git add . git commit -m "login and tasklist" git push origin master // 出

gitupdates were rejected because the tip of your current branch is behind its remote counterpart

剛建立的github版本庫,在push程式碼時出錯: $ git push -u origin master To [email protected]:******/Demo.git ! [rejected] master -> master (non-fast-forwa

刪除github專案失敗時出現:Updates were rejected because the tip of your current branch is behind

刪除github上的專案失敗報錯如下 這是由於我本地的倉庫和遠端github倉庫發生了衝突導致的,解決方法如下 1.強制使用push git push -u origin master -f 注意:使用此方法會使遠端的修改丟失,一般是不可取的 2.推送前先將遠端倉

Updates were rejected because the tip of your current branch is behind 問題出現解決方案

提供如下幾種方式: 1.使用強制push的方法(多人協作時不可取): git push -u origin master -f 2.push前先將遠端repository修改pull下來 git pull origin master git push -u origin master 3.不想me

Git工作筆記004---torisegit使用時Updates were rejected because the tip of your current branch i

   JAVA技術交流QQ群:170933152        因為要跟別的公司一塊合作開發,我們用svn他們用git,現在又得用git  我在提交的時候:報如下錯誤: git.exe pu

Git提交到GitHubUpdates were rejected because the remote contains work that you do not have locally

轉自:https://blog.csdn.net/u011284073/article/details/81609707  在使用Git將本地專案上傳到GitHub上時,鍵入命令: git push -u origin master 報錯提示:Updates were reject

git Updates were rejected because the remote contains work that you do 解決辦法

Username for 'https://github.com': dummymare Password for 'https://[email protected]': To https://github.com/dummymare/Hello-World

Updates were rejected because the remote contains work that you do

cau 需要 倉庫 cnblogs 提交 添加文件 cte ges soft 每次建立新的倉庫,提交的時總會出現這樣的錯誤,真是頭疼,...... 直接開始正題,git 提交的步驟: 1. git init //初始化倉庫 2. git add .(文件na

Updates were rejected because the remote contains work that you do hint: not have locally. This is u

今天在學習git時, $ sudo git push origin master 報錯了: To https://github.com/xxxxx/xxxx.git ! [rejected] master -> master (fetch firs

git push ! [remote rejected] ceshi -> ceshi (pre-receive hook declined)

上傳到gitlab倉庫報錯 ! [remote rejected] ceshi -> ceshi (pre-receive hook declined) error: failed to push some refs to 'http://47.95.225.115/android/

<問題解決02>Linux虛擬機使用git push--解決方案如下:

hello class lai git onf http afr 再次 log 問題描述:   使用git push 報錯:     error: The requested URL returned error: 403 Forbidden while accessing

git push

url idt mage com bubuko jpg git ima tps Q:如圖 A: git remote set-url origin https://gitee.com/null_134_0261/travel.gitgit push

git push :missing Change-Id in commit message footer

git push 評論 綠色 問題 push tid 還在 下載 異常 使用gerrit後,提交代碼會出現如下截圖問題: 臨時解決: step1:把上面紅色的那條gitidir復制下來執行下: step2:執行下面的命令會添加change_id   git c

mac系統idea開發工具git -push :no matching host key type found. Their offer: ssh-dss

bsp 開發 版本 git cheng 算法 com push href 原因: 根本原因之所以報錯是因為OpenSSH7.0以後的版本不再支持ssh-dss(DSA)算法,官方的說法是這個算法太弱了。MACOS升到10.12附帶的openssh版本是7.4,如下:?~ss

git push檔案過大,去掉大檔案也同樣的錯誤

原因:大檔案存在沒有被提交的commit記錄裡面 解決方案:刪除有大檔案的commit記錄即可 我的解決流程 1 git status 產看未被傳送到遠端程式碼庫的提交次數 2 git cherry -v 檢視未被傳送到遠端程式碼庫的提交描述和說明 3 git res

git push error: failed to push some refs to 解決記錄

D:\csdn\csdnhb-ui>git push origin master:moshangshang To githy.csdn.com:pdd-fe/csdnhb-ui.git ! [rejected] master -> moshangshang(non-fast-forwar

使用form的方法(例如:reset,clear等)Uncaught TypeError: Cannot read property 'tip' of undefined(…)的原因

 在瀏覽器中debug前端程式碼時,第一次按一個按鍵,沒有問題,第二次開始再按這個按鍵的時候,出現了錯誤Uncaught TypeError: Cannot read property 'tip' of undefined(…),雖然不影響功能,但是出現紅色的錯誤總是感覺