Skip to content

Instantly share code, notes, and snippets.

@kbaird
Created May 10, 2012 16:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kbaird/2654115 to your computer and use it in GitHub Desktop.
Save kbaird/2654115 to your computer and use it in GitHub Desktop.
Binary diff setup in .git/config
[diff "bz2"]
binary = true
textconv = /bin/bzcat
[diff "gzip"]
binary = true
textconv = /bin/zcat
[diff "tar"]
binary = true
textconv = tar --to-stdout -xf
[diff "tar-bz2"]
binary = true
textconv = tar --to-stdout -xjf
[diff "zip"]
binary = true
textconv = unzip -p
Add the above or similar to your .git/config, along with entries like below in ~/.gitattributes, the project's .gitattributes (to check it in) or .git/info/attributes (to not check it in):
*.bz2 diff=bz2
*.gz diff=gzip
*.tar diff=tar
*.tar.bz2 diff=tar-bz2
*.zip diff=zip
(References http://git-scm.com/book/ch7-2.html)
@kbaird
Copy link
Author

kbaird commented Nov 13, 2013

See also https://git.wiki.kernel.org/index.php/GitTips for LibreOffice files. odt2txt is available as an apt package.

@refractalize
Copy link

If you want to put .gitattributes in your $HOME then you will have to put this into your ~/.gitconfig:

[core]
  attributesFile = ~/.gitattributes

See https://git-scm.com/docs/gitattributes

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