Last active
December 17, 2015 02:28
-
-
Save infotroph/5535527 to your computer and use it in GitHub Desktop.
A quick and dirty approach to make git-diff on MS Office documents use the decompressed XML instead of treating them as binary. Known bugs: Complains on empty components (notably including the always-present [Content_Types].xml), and actually shows all changes to the XML (so good luck finding meaningful changes to an Excel file under all the dis…
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
# /usr/local/bin/xmlzip.sh: | |
#!/bin/bash | |
for i in `unzip -Z -1 "$1"`; do | |
echo "$i" | |
unzip -a -p "$1" "$i" | xmllint --format - | |
done | |
# ~/.gitconfig: | |
[diff "xmlzip"] | |
textconv = /usr/local/bin/xmlzip.sh | |
# .gitattributes: | |
*.xlsx diff=xmlzip | |
*.docx diff=xmlzip | |
*.pptx diff=xmlzip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome! Can I suggest making it an actual project repo?