7

Currently, before merging a branch, I use the following commands to see what changes will be merged:

base=$(git merge-base other HEAD)
git diff $base other

Is there a single git command to achieve this?

Regards, Jochen

Jochen
  • 7,270
  • 5
  • 24
  • 32
  • As Sven says, there is a way - though in general, even if there's not, you could elide your temporary variable and wrap the whole thing up in an alias. – Cascabel Nov 10 '10 at 15:33
  • possible duplicate of [How can I preview a merge in git?](http://stackoverflow.com/questions/5817579/how-can-i-preview-a-merge-in-git) –  Apr 10 '14 at 23:58

2 Answers2

7
git diff ...other
Sven Marnach
  • 574,206
  • 118
  • 941
  • 841
1

Note: the question "How can I preview a merge in git?" does mention the context of seeing what would be merged when fetching:

[alias]
    # fetch and show what would be merged (use option "-p" to see patch)
    incoming = "!git remote update -p; git log ..@{u}"

With:

  • "git incoming" to show a lot of changes, or
  • "git incoming -p" to show the patch (i.e., the "diff"),
  • "git incoming --pretty=oneline", for a terse summary, etc

You can find more elaborate scripts in this:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250