问题
I want to get list of unique commits in all branches, but if somebody is using rebase in branch commits loose parents. How to solve this problem? How to get list of commits that made unique changes?
回答1:
I use
git log --oneline --graph --cherry-pick --left-right
The operative verb you are looking for 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.
The addition of left-right makes it easier to see differences between branches:
git log --oneline --graph --cherry-pick --left-right BRANCH1...BRANCH2
< 6abfdcf only on BRANCH1
> 7b2127a only on BRANCH2
> 919ca24 only on BRANCH2
Here, also, cherry-picks or merged commits are 'hidden' from view
来源:https://stackoverflow.com/questions/9184378/how-to-get-only-unique-commits-in-git