Git 既落後(ahead)又超前 (behind)解決方案:
在出現錯誤的分支執行指令:
git push -f origin master
注意:我遇到一個更奇怪的問題。
我們的版本是從master拉到develop,從develop拉到jdev(個人分支)。直接推送個人分支合并正常,結果從develop拉版本時提示即超前又落後版本。
在個人分支執行:
git push -f origin master
仍舊報錯。沒有辦法删除develop,讓後在個人分支拉master的代碼,結果仍舊報這個錯誤,然後在個人分支執行:
git push -f origin master
。代碼合并成功。
估計這個是git誤報。master和develop的代碼一樣,實際是個人分支既落後(ahead)又超前 (behind),誤報成develop即既落後(ahead)又超前 (behind)。隻有在個人分支執行:
git push -f origin master
才行。