Marcus Leon
Marcus Leon

Reputation: 56699

Git: Determining merge changes when no conflicts

When we do typical merges (ie: from branch A to B) with conflicts I can see the differences by running:

git status
git difftool --dir-diff --cached 

But if there are no conflicts then these commands don't return any results. We run git push to push the changes to the remote repo (branch B in this example).

What command can you run to see the differences which you just pulled down (and pushed) in this case?

Upvotes: 3

Views: 71

Answers (2)

Wolf
Wolf

Reputation: 4462

Git diff is "helping" you by telling you that the merge introduced no new changes. All the changes from the merge are accounted for by the changes in its parents. You can see the individual changes that went into the merge by specifically comparing the merge with one or the other parent, e.g.,

git diff <merge-commit> <merge-commit>^1 # diff against 1st parent
git diff <merge-commit> <merge-commit>^2 # diff against 2nd parent

And so on if you have an octopus merge. These will show you the individual changes that each parent brought into the merge.

If the merge commit in question is your current head, then you can

git diff HEAD^1
git diff HEAD^2

Upvotes: 1

Eduardo Hitek
Eduardo Hitek

Reputation: 613

Maybe the git diff command will show what you want.

Upvotes: 2

Related Questions