Last active
January 2, 2016 23:29
-
-
Save infotroph/8377075 to your computer and use it in GitHub Desktop.
Say you have an XLS file you've stupidly allowed into your repository and even more stupidly tried to update. Here's a shortcut to open the current and last-committed versions for a side-by-side eyeball diff.
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
#!/bin/bash | |
FN=`basename "$1"` | |
TMPFILE=`mktemp -t gitxlscmp."${FN}"` || exit 1 | |
git show HEAD:"$1" > "$TMPFILE" | |
open -a "Microsoft Excel" "$TMPFILE" "$1" | |
# Want to delete $TMPFILE once open in Excel, | |
# but $(open) returns immediately, so check for ourselves | |
until lsof -a -c "Microsoft Excel" "$TMPFILE" > /dev/null; do | |
sleep 0.5 | |
done | |
rm "$TMPFILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I rolled this into my gitMSOfficeDiff repository; look there for any updates.