Skip to content

Instantly share code, notes, and snippets.

@jamesmunns
Created February 4, 2016 02:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmunns/e5dc90d82b4800fa6e7e to your computer and use it in GitHub Desktop.
Save jamesmunns/e5dc90d82b4800fa6e7e to your computer and use it in GitHub Desktop.
# COMPARE TWO REFERENCES (Branch, Tag, Commit), both in Read-Only Mode
# Use (from the git repo root):
# <path to script>/diffref.sh master 123abcd
# Build destination folder
DATEHASH=`echo "obase=16; $(date +%s)" | bc`
DESTFOLDER1=/tmp/diffref-$DATEHASH-$1
DESTFOLDER2=/tmp/diffref-$DATEHASH-$2
mkdir $DESTFOLDER1
mkdir $DESTFOLDER2
# Export Reference
git archive $1 | tar -xC $DESTFOLDER1
git archive $2 | tar -xC $DESTFOLDER2
# Fire Diff
bcomp -ro1 -ro2 $DESTFOLDER1 $DESTFOLDER2 -title1=$1 -title2=$2
# Clean Up
rm -rf $DESTFOLDER1
rm -rf $DESTFOLDER2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment