In a git merge, how do you just replace your version with the version git says there is a conflict with?

后端 未结 2 814
-上瘾入骨i
-上瘾入骨i 2021-02-01 16:56

I have two files: A and B. If I have been working on A and a partner is working on B, I want to merge files A and B. B is already committed. Let\'s say my partner already made t

2条回答
  •  执念已碎
    2021-02-01 17:45

    If their is a conflict during a merging operation (merge, cherry-pick, rebase, etc...) you can resolve conflict by picking one side of the changes by doing :

    git checkout --ours (this will choose the local changes)

    or

    git checkout --theirs (this will choose the remote changes)

    then finishing resolving the conflict as usual with:

    git add 
    

    then commit with:

    git commit
    

提交回复
热议问题