git show <commit>
on a simple commit (i.e. not a merge commit) git will show the commit
message and the modified files including their diffs. Adding "--name-only"
will list only the file names of the modified files.
On the other hand, when running "git show" against a merge commit, things
are different. A merge commit has multiple parents (2 in the simple case)
and "git show" will (by default) only show the files where there differ
between the merge commit and _all_ the parents. For a two parent merge
commit (the ordinary case) this means that "git show" will only show the
files that were somehow merged. The files that were either ignored from the
other branch or copied straight over are not displayed.
However, what could be considered most intuitive when doing
git checkout branch1
git merge branch2
would be to show the files that were modified in branch1 as this was the
target of the merge (and the only branch whose head was moved to point to
the merge commit). So what I would like to see by default would be the diff
between the merge commit and its 1st parent.
To accomplish that, I can write
git show --first-parent
Can somebody explain:
a) What is the default behaviour normally used for?
b) Is there another way of accomplishing what I am doing with
Thank you for helping.
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.