Git merge -s theirs: Simply?

前端 未结 3 1304
余生分开走
余生分开走 2020-12-15 05:48

I have checked out the various questions on this. The first provides a huge question and answer (relevant? not sure) and the second provides a wrong answer as best answer.

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 06:04

    I'm leaning toward the git reset --hard BRANCHNAME option myself, but I've discovered that there is a "their" in Git (v. 1.7.1 at least).

    If you want to try it, just add an "-Xtheirs" argument to the merge command.

    For example, starting in master:

    git checkout -b editBranch
    -- edit your files --
    git add .
    git commit -m "Updated the files"
    git checkout master
    git merge -Xtheirs editBranch

    If you have deleted any files in the editBranch, you'll get a merge conflit that can be resolved with git rm FILENAME.

    Once again, it seems likely that the reset --hard BRANCHNAME is better option, but if you have a case where you really need a theirs, this should get you there.

提交回复
热议问题