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

前端 未结 6 823
小蘑菇
小蘑菇 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:27

    Also, you can use

    git log --left-right --graph --cherry-pick --oneline devel...next
    

    to get a nice list of actual different commits not shared between the branches.

    The operative word is --cherry-pick

    --cherry-pick

    Omit any commit that introduces the same change as another commit on the "other side" when the set of commits are limited with symmetric difference. For example, if you have two branches, A and B, a usual way to list all commits on only one side of them is with --left-right, like the example above in the description of that option. It however shows the commits that were cherry-picked from the other branch (for example, "3rd on b" may be cherry-picked from branch A). With this option, such pairs of commits are excluded from the output.

    Update As mentioned in a comment, recent versions of git added --cherry-mark:

    --cherry-mark

    Like --cherry-pick (see below) but mark equivalent commits with = rather than omitting them, and inequivalent ones with +.

提交回复
热议问题