Skip to content

Instantly share code, notes, and snippets.

@infotroph
Last active January 2, 2016 23:29
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 infotroph/8377075 to your computer and use it in GitHub Desktop.
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.
#!/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"
@infotroph
Copy link
Author

I rolled this into my gitMSOfficeDiff repository; look there for any updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment