How to identify conflicting commits by hash during git rebase?

后端 未结 8 1878
误落风尘
误落风尘 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:07

    cat .git/rebase-apply/original-commit
    

    Given this:

    A---B---C---D
         \
          E---F---G
    
    $ git checkout G
    $ git rebase D
    

    and given that there's a merge conflict trying to apply F:

    A---B---C---D--E'--!
         \
          E---F---G
    

    then the original-commit file will show the hash of F. This is "theirs" version.

    Also, HEAD (.git/HEAD) will be E' in this case. This is "mine" version. HEAD^ will be "base" version.

    This is true for at least git 1.7.9

提交回复
热议问题