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

后端 未结 2 805
-上瘾入骨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:51

    Let's say both you and your partner modified the same file, and is committed to each respective repository.

    git pull                             # fetch/merge partners changes
    # merge fails, conflict
    git checkout origin FILE_TO_REPLACE  # replace changes with partners ver
    git commit                           # finish merge
    

提交回复
热议问题