Created
July 3, 2013 12:58
-
-
Save mietek/5917659 to your computer and use it in GitHub Desktop.
Better git diff for branches which had stuff merged in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example: | |
# | |
# giterdun 339f7db..6ed04fa | |
# git diff | $EDITOR | |
# BRANCH=`git rev-parse --abbrev-ref HEAD` && git checkout . && git checkout master && git branch -D $BRANCH | |
giterdun() | |
{ | |
RANGE=$1 | |
SHAS=`git log --no-merges --first-parent --pretty=%h --reverse $RANGE` | |
if [ $? -ne 0 ]; then | |
return 1 | |
fi | |
BEGIN=`echo $RANGE | sed 's/\.\..*$//'` | |
END=`echo $RANGE | sed 's/^.*\.\.//'` | |
BRANCH=`uuidgen` | |
echo "Branching $BRANCH off $BEGIN..." | |
git checkout -q $BEGIN | |
git checkout -qb $BRANCH | |
for SHA in $SHAS; do | |
echo "Applying $SHA..." | |
git show -p $SHA | git apply | |
if [ $? -ne 0 ]; then | |
git show -p $SHA | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment