Skip to content

Instantly share code, notes, and snippets.

@shuhei
Last active April 8, 2017 10:55
Show Gist options
  • Save shuhei/504b5abdd8c27363d02f to your computer and use it in GitHub Desktop.
Save shuhei/504b5abdd8c27363d02f to your computer and use it in GitHub Desktop.
git diff pptx
*.pptx diff=pptx
[diff "pptx"]
textconv = unpptx

git diff pptx

  1. Make sure you have iconv and perl in your PATH.
  2. Put unpptx somewhere in your PATH and chmod +x unpptx.
  3. Add the lines to your ~/.gitconfig.
  4. Add the lines to your .gitattributes in your repo.

In addition to what Managing ZIP-based file formats in git by tante does, this setup adds line-breaks to huge xml chunks and ignores binaries for better diff result. So, binary changes do not appear in the diff result.

#!/bin/sh
unzip -c -a $1 | iconv -f utf-8 -t utf-8 -c | perl -pe 's/></>\n</g' | perl -p -0777 -e 's/ extracting: .*( inflating: |\Z)/\1/s'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment