Chris Snyder
Chris Snyder

Reputation: 31

How to list what changed during a merge in Git?

Something I still haven't gotten my head wrapped around with regards to using Git is how do I list 'what changed' as a result of a merge in Git? Ultimately, I just want a list of files that were modified as a result of the merge.

I'm thinking that maybe I do something like this? 'git diff --name-only '

Just so you know, I am using 'non-fast-forwarded' merges.

thx

Upvotes: 3

Views: 165

Answers (3)

Dan Ray
Dan Ray

Reputation: 21893

I like

git diff --stat HEAD..HEAD^

That gives you filenames and a one-line listing of the number of changed lines in the file. It's handy to know what changed a little and what changed a lot.

Upvotes: 2

Kit Ho
Kit Ho

Reputation: 26958

Should be this one

git diff HEAD^ HEAD

HEAD^ is your merge commit HEAD is your head of your branch

Upvotes: 0

Carl Norum
Carl Norum

Reputation: 224844

If I understand correctly, you just did git merge, and ended up with the merge commit as your head. You can check the changes from the merge commit by doing:

git diff --name-only HEAD^

Which will list all of the files that changed between your head and the previous commit.

Upvotes: 0

Related Questions