3

"git diff master...topic" is not it.

If master has been merged into topic after branching "git diff master...topic" will show changes that are already in master.

What you want is the equivalent of the following:

git merge topic --no-commit
git diff --staged
git merge --abort

Community
  • 1
  • 1
stackblow
  • 185
  • 4
  • 1
    Did you mean `What *I* want is the equivalent of the following` ? – quetzalcoatl Jun 16 '15 at 19:44
  • 1
    What about `git diff master topic`? – axiac Jun 16 '15 at 20:35
  • Perhaps you need to start by defining what you mean by "merge changes"... All changes that will be introduced by the merge might be something like `git diff $(git merge-base master topic) topic`... Of course that doesn't cover any conflicts that might occur, but it does represent all the changes that `git merge` will *attempt* to make... – twalberg Jun 16 '15 at 20:42
  • `git diff $(git merge-base master topic) topic` is equivalent to `git diff master...topic` and I already explained why it's inadequate – stackblow Jun 16 '15 at 23:37

1 Answers1

3

You can write a bash script with those commands in it.

#!/bin/sh

git merge topic --no-commit
git diff --staged
git merge --abort
Tristan Vigil
  • 213
  • 1
  • 12