How to automatically resolve merge conflicts by selecting the remote version in Git?

前端 未结 2 659
离开以前
离开以前 2021-01-01 16:33

Is there any way to specify to git to automatically resolve the conflicts for a pack of files by taking the remote version for each of them? For instance, to take the remote

2条回答
  •  迷失自我
    2021-01-01 17:21

    git-merge seems to support only the "ours" strategy, where the result of a merge is the local version. And that only for the whole tree.

    If you enter a conflicted state while doing a merge, you can use git-checkout's --theirs with a path to retrieve files from the index.

    Finally you can git-reset to force parts of the tree to a specific commit.

    There's now also http://www.seanius.net/blog/2011/02/git-merge-s-theirs/ who basically recommends making a merge -s ours and then reverse-apply the changes.

提交回复
热议问题