Git - View conflict resolutions after merge commit

孤街醉人 提交于 2019-12-03 20:47:22

As you suggest, re-running the merge is your best bet. However you don't have to revert it, you can just repeat it using a temporary branch. If $M is the merge commit, then:

$ git checkout -b merge-redo ${M}^1
$ git merge ${M}^2

That is, create a new branch pointing to the first parent of the merge commit, then merge in the second parent. Note that you'll need to use the same -s (merge strategy) and/or -X (strategy option) options as were used in the original merge in order to get exactly the same conflicts.

At this point, git status shows the files in conflict and git log --merge and git log --merge -- <files> can be used to see the commits that contributed to the conflicts.

If you know that some files were resolved correctly, you can take their resolutions from the original merge conflict like this:

$ git checkout $M -- <files ...>
$ git add <files ...>

This can help to cut down on the mental load involved in understanding a large merge.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!