[英]Trying to merge two branches (one is very old, trying to pull master code) but there are conflicts in every file
沖突甚至不應該是沖突...大多數沖突都在我添加的文檔中,例如tihs:
<<<<<<< HEAD
# returns the max_sequence for this section
=======
>>>>>>> merged with other_branch_that_isnt_master
我做的命令是git pull --rebase origin master
但是當我只是做git pull origin master
,到處仍然有很多沖突。
為什么沒有適當地合並? 就像git放棄了生命。
如何獲得git實際合並我的文件?
我在Mac Lion上使用git。
您可能選擇了錯誤的分支並導致分支分歧。 這意味着重新基准將不再完全適用,從而產生沖突。
一種選擇是執行git merge
並完成解決沖突的艱苦的手動工作。 分支合並后,您只需要做一次工作。
另一種選擇是忽略master
另一個副本中的所有更改,並使您的副本具有權威性。 不建議這樣做,但這取決於您的用例:
git fetch
git merge -s ours origin/master
另一種選擇是按照Dave的建議重寫並修復提交歷史記錄。 總結如下:
gitk --all
或git log --graph --all
可視化歷史記錄,並查看分支的分支位置。 git reset --hard
將歷史回滾到該提交 git pull --rebase
git cherry-pick
您的提交回到重新建立的歷史上,希望將沖突降到最低。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.