See what would be merged in one git command?

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?

  • Push to github gist failing
  • Git doesn't remove files from remote
  • openshift nodeJS app - git up to date/server running without errors but I still see welcome page
  • EGit Ignore / Android
  • Alternatives to cherry-picking
  • Get a “git command not found” error on mac though .profile file is updated
  • Regards,
    Jochen

  • How to Remove GIT version control from XCode 5 Project
  • GET pull request merge commit sha from pull request number using github api
  • What is the difference between --parameter and -parameter?
  • How to require confirmation for git reset --hard?
  • Git: “wildcard refspec” with no match on remote, when pulling
  • Using github locally without publishing to github servers
  • 2 Solutions collect form web for “See what would be merged in one git command?”

    git diff ...other
    

    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:

    • GitHub example:
    • gitpastiche
    Git Baby is a git and github fan, let's start git clone.