How to see which commits in one branch aren't in the other?

前端 未结 6 827
小蘑菇
小蘑菇 2020-11-28 00:56

I have two branches devel and next. In devel I have a more or less huge amount of commits. Some of the commits are cherry picked in next

6条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 01:28

    The little-used command git cherry shows you the commits which haven't yet been cherry-picked. The documentation for git cherry is here, but, in short, you should just be able to do:

    git checkout devel
    git cherry next
    

    ... and see output a bit like this:

    + 492508acab7b454eee8b805f8ba906056eede0ff
    - 5ceb5a9077ddb9e78b1e8f24bfc70e674c627949
    + b4459544c000f4d51d1ec23f279d9cdb19c1d32b
    + b6ce3b78e938644a293b2dd2a15b2fecb1b54cd9
    

    The commits that begin with + will be the ones that you haven't yet cherry-picked into next. In this case, I'd only cherry-picked one commit so far. You might want to add the -v parameter to the git cherry command, so that it also outputs the subject line of each commit.

提交回复
热议问题