I have two branches in git, where one branch master
contains all commits, and another branch, e.g., release
, which contains some cherry-picked commits from the first branch master
. Since the commits are cherry-picked in release
, they have different commit hashes than the corresponding commits in master
, but the commit messages are the same.
Now I want to find commits from master
, which were not cherry-picked into release
. Note that the cherry-picked commits might be different in code from original commits due to conflict resolutions.
How can I do it? Is there native support in git
for this?
Example:
master
branch:
git checkout master
git log --oneline -7
gives
2cba4b1d (HEAD -> master) Message subject for commit 7
f54fc16f Message subject for commit 6
4d871cbd Message subject for commit 5
a83ed44c Message subject for commit 4
48d0fb73 Message subject for commit 3
931da9a6 Message subject for commit 2
8553323b Message subject for commit 1
release
branch
git checkout release
git log --oneline -5
gives
d65a04c6 (HEAD -> release) Message subject for commit 7
8aeecd92 Message subject for commit 6
2a54e335 Message subject for commit 4
99985f38 Message subject for commit 3
e76a9bb4 Message subject for commit 1
So the difference between the two branches will be two commits with message subjects:
Message subject for commit 5
Message subject for commit 2
It is also OK if it shows commit hashes:
4d871cbd Message subject for commit 5
931da9a6 Message subject for commit 2
Additional clarifications and requirements:
The above example returns the diff in the same order as commits were merged. Getting the same order in the result as in the original commit logs helps to identifier commits in the original commit log of master
. It would be nice if it is possible to achieve too.
In my case both branches have linear history and there are no merge commits.