Skip to content

Instantly share code, notes, and snippets.

@timplunkett
Created January 25, 2018 13:47
Show Gist options
  • Save timplunkett/5d0e8947864952c3d5aa075cca6939e3 to your computer and use it in GitHub Desktop.
Save timplunkett/5d0e8947864952c3d5aa075cca6939e3 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: git idiff [comment-number] [interdiff-rev] [base-rev]"
exit 1
fi
COMMIT=${2:-"HEAD^"}
BASE_BRANCH=${3:-"8.6.x"}
REMOTE=${4:-"origin"}
BRANCH=$(git branch-name)
BRANCH=${BRANCH//*\//}
git diff $REMOTE/$BASE_BRANCH... > ~/Desktop/$BRANCH-$1.patch
git log --oneline --reverse --no-decorate $COMMIT... && echo
echo $BRANCH-$1-interdiff.txt
git diff $COMMIT > ~/Desktop/$BRANCH-$1-interdiff.txt
echo $BRANCH-$1.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment