GIT - Rebase - How to deal with conflicts

后端 未结 5 821
长发绾君心
长发绾君心 2021-02-09 02:07

I am working on a project that has two branches: master and feature

The feature branch was created some time ago and has numerous

5条回答
  •  忘掉有多难
    2021-02-09 02:53

    I had a similar issue and it turned out that I was resolving conflicts with --ours when I should have been using --theirs.

    The reason is that --ours is your changes in a merge, but in a rebase it is --theirs because git effectively removes your commits and replays copies of them.

    So when you resolve a conflict with your version with a rebase do:

    git checkout --theirs some.file git add some.file

    but when resolving a conflict with your version with a merge do:

    git checkout --ours some.file git add some.file

提交回复
热议问题