Skip to content

Instantly share code, notes, and snippets.

@17twenty
Created February 19, 2013 12:20
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save 17twenty/4985374 to your computer and use it in GitHub Desktop.
Save 17twenty/4985374 to your computer and use it in GitHub Desktop.
Git diff odt files
To get Git to diff between your odt/odp/ods files you will need to do the following things:
Install a conversion tool
$ sudo yum install odt2txt
Create your git config info directory if it's not already there
$ mkdir -p ~/.config/git/info
Add in attributes (you can paste this straight in or edit the file accordingly)
$ cat > ~/.config/git/info/attributes <<DELIM
*.ods diff=odf
*.odt diff=odf
*.odp diff=odf
DELIM
Add a Git diff filter (again, you can paste this straight in or edit the file accordingly)
$ cat >> ~/.gitconfig <<DELIM
[diff "odf"]
binary = true
textconv = odt2txt
DELIM
And that's it. Job done.
@weehongyeo-spire
Copy link

I tried this in Ubuntu 16.04, git version 2.14.2 and it doesn't work.

Had to put the attributes in ~/.config/git/attributes instead of ~/.config/git/info/attributes for it to work. Think may be due to version changes.

Thanks for putting this here! It is helpful

@pierrechtux
Copy link

Same experience as you, @ weehongyeo-spire , on a Devuan GNU/Linux 3 with git version 2.20.1:
mv ~/.config/git/info/attributes ~/.config/git/
solved the problem.

Thank you, I can happily git diff the .odt's!

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