3

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?

Marcus Leon
  • 55,199
  • 118
  • 297
  • 429

2 Answers2

2

Maybe the git diff command will show what you want.

Eduardo Hitek
  • 553
  • 2
  • 13
  • `git diff` does the same thing as `git difftool` (what I'm trying). Doesn't return any results. – Marcus Leon Aug 20 '15 at 14:01
  • 1
    Huuum, in this case you can use the `git log` command, find the hash code for the merge commit, and then use `git diff ` [Example](http://stackoverflow.com/questions/5072693/how-to-git-show-a-merge-commit-with-combined-diff-output-even-when-every-chang) – Eduardo Hitek Aug 20 '15 at 14:08
  • That works: `git log -n 1` shows the merge commit and `git diff xxx~1` lists the differences. – Marcus Leon Aug 28 '15 at 16:18
1

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
Wolf
  • 4,254
  • 1
  • 21
  • 30