How to identify conflicting commits by hash during git rebase?

后端 未结 8 1876
误落风尘
误落风尘 2020-12-01 03:37

When I encounter a merge conflict using git rebase, how can I identify the source of the conflict in terms of commits, rather than just file difference

8条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 04:09

    During a git rebase which stops to resolve conflicts, the following command will show the conflicting commit (all of it, not just the conflicting files), that is, your commit currently being replayed/rebased onto the new base, regardless of where you are up-to:

    git show $(< .git/rebase-apply/original-commit)
    

    If you want to see only the conflicts for a specific conflicting file (the one you are resolving), in-isolation:

    git show $(< .git/rebase-apply/original-commit) -- /path/to/conflicting/file
    

    No cats were abused in the construction of this answer :).

提交回复
热议问题