Skip to content

Instantly share code, notes, and snippets.

@mlsteele
Created February 12, 2019 20:49
Show Gist options
  • Save mlsteele/283574eb57d58a7d16a8f21d9c364993 to your computer and use it in GitHub Desktop.
Save mlsteele/283574eb57d58a7d16a8f21d9c364993 to your computer and use it in GitHub Desktop.
You just ran `git merge origin/master`. But what happened?
#!/usr/bin/env bash
# You just ran `git merge origin/master`. But what happened?
# Shows the diff between
# - your changes from old master before merging
# - your changes from NEW master AFTER merging
COMMON_ANCESTOR=$(git merge-base $(git show -s --pretty=%P HEAD))
git d $COMMON_ANCESTOR..HEAD^1 > /tmp/diff1.txt
git d HEAD^2..HEAD > /tmp/diff2.txt
kdiff3 /tmp/diff{1,2}.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment