dFL
dFL

Reputation: 35

Why does "git log --name-only" show one file change, but "git diff" shows more?

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?

Upvotes: 2

Views: 1386

Answers (1)

Michael Wild
Michael Wild

Reputation: 26341

You need to change your git-log call to

git log --name-only sha1..sha2

Upvotes: 1

Related Questions