log -p hides changes in merge commit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git log -p never shows a diff for merge commits.  It is nice that it
does not show a giant diff that is the sum of all of the changes being
merged, but any manual changes made on top of the merge are also lost
from view, and this is not good.  Here is a reproduction recipe:

git init
echo foo > a
git add a
git commit -m "added a"
git branch other
git checkout other
echo bar > b
git add b
git commit -m "added b"
git checkout master
git merge other
git log -p

At this point there is no diff shown in the log output.  This is fine
since there were no changes needed to complete the merge, and the
addition of b is already documented in the merged commit.  The problem
is that if you add --no-merge to the git merge, and then:

echo bart > a
git add a
git commit

Now in addition to merging b, you have modified a, but git log -p still
shows no diff, effectively hiding the fact that you snuck in a
modification to a during the merge.

It seems that adding -c or --cc to the log correctly shows the change to
a, but why is this not shown by default?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]