2

When I run

git log --name-only

it shows sha1 and sha2 as consecutive commits and only one file was changes in sha2.

However, when I run

git diff sha1 sha2

it shows differences in a lot of files. Why is this? sha1 and sha2 are consecutive commit ids that I got from git log --name-only. sha1 is the earlier commit.

I thought that git diff would only show differences in files that are listed by git log --name-only.

The sha1 and sha2 are consecutive commits in the same branch.

sha1 was a cherry pick from B1 and sha2 was cherry picked from B2.

I found that a file that was not listed in git log --name-only was modified and basically my changes in B1 were overwritten by B1 commit, even though it isn't listed as having been modified.

Is there an issue with the cherry-picking here where changes are picked up unknowingly?

dFL
  • 35
  • 5
  • See also http://stackoverflow.com/questions/5256249/git-diff-doesnt-show-enough/5257065#5257065 – VonC Feb 26 '13 at 08:15

1 Answers1

1

You need to change your git-log call to

git log --name-only sha1..sha2
Michael Wild
  • 21,851
  • 3
  • 36
  • 40
  • I forgot to clarify, sha1 and sha2 are consecutive commit ids when I ran git log --name-only. Though when I ran it that way, I got a longer list of commits. It just seems odd that one command shows them as sequential commits and another shows more changes in between. – dFL Feb 27 '13 at 17:12
  • That's the thing: without the dots, it just shows *all* commits reachable from these two commits, right up to the very first commit. – Michael Wild Feb 27 '13 at 21:06
  • I'm not sure why I don't get any notifications when someone responds, but looks like my understanding of git log needs to be expanded. Thanks Michael. – dFL Mar 06 '13 at 18:17