Skip to content

Instantly share code, notes, and snippets.

@wejrowski
Last active October 21, 2016 17:56
Show Gist options
  • Save wejrowski/fda56cae65a7366a4118d1174d928bd5 to your computer and use it in GitHub Desktop.
Save wejrowski/fda56cae65a7366a4118d1174d928bd5 to your computer and use it in GitHub Desktop.
Git diff branch changes
# Shoot.. this is pointless actually. You can do this by `git diff origin/development...HEAD`
# Do a git diff between development, only on your changes by finding
# the last commit hash in your branch which is in development and diffing on that.
origin_development_hashes=$(git log --pretty=format:'%H' origin/development | tail -300)
for hash in `git log --pretty=format:'%H' | tail -300`; do;
[[ $origin_development_hashes =~ "$hash" ]] && found=$hash && break;
done;
if [ $found != "" ]; then
git diff $found..
else
diff origin/development..
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment