Reputation: 3746
I have 2 branches: master
and feature
. I am on my branch feature
. I create 2 commits:
user:~/tmp$ git status
On branch feature
user:~/tmp$ echo foo >foo
user:~/tmp$ git add foo
user:~/tmp$ git commit -m "foo"
user:~/tmp$ echo bar >foo
user:~/tmp$ git commit -am "bar"
Then I checkout master
branch and merge branch feature
without fast-forwarding:
user:~/tmp$ git checkout master
user:~/tmp$ git merge feature --no-ff
This creates merge commit:
user:~/tmp$ git log
commit 6077908acc97810b27f2ac53cdeed4df1c5dd6cf (HEAD -> master)
Merge: 5a22c43 63ef35e
Merge branch 'feature1' into feature
* feature:
bar
foo
Is it possible to know which commits were present in the merge commit, other than by merge commit message (which could be modified)?
Upvotes: 1
Views: 1048
Reputation: 4476
You can log the commits of the merged branch with the following:
git log 6077908^..6077908^2
To be read as "log all the commits which are not in the first parent of the merge commit (6077908^
, which is the last commit of master before the merge) but which are in the second parent of the merge commit (6077908^2
, which is the branch you merged).
Upvotes: 2