1

Related How to perform better document version control on Excel files and SQL schema files

That SO question led me to this blog: https://tante.cc/2010/06/23/managing-zip-based-file-formats-in-git/

Which suggested I make these changes to a couple of git files in my repo:

✗ cat .gitattributes                      
*.xlsx diff=zip

✗ cat .gitconfig 
[diff "zip"]
textconv = unzip -c -a

But when I run a diff:

git diff data/localizations-us.xlsx

diff --git a/data/foo.xlsx b/data/foo.xlsx
index 11920cc..8b8f6d3 100644
Binary files a/data/foo.xlsx and b/data/foo.xlsx differ

This is not what I was looking for.

There is a tool called xls2txt that was suggested in that other question but it is a binary hosted on what appears to be a personal website; I'm reluctant to use it for security reasons. Also reluctant to put a probably completely unsupported tool into my development pipeline.

Is it possible to configure git to unzip xlsx files automatically and compare the resultant xml files?

jcollum
  • 36,681
  • 46
  • 162
  • 279
  • 1
    This `.gitconfig` file—is it in `$HOME/.gitconfig`, or did you create a file `.gitconfig` in your repository next to your `.gitattributes` file? If the latter, that explains the problem: Git does not read such a file. It will read `.git/config` as well as your personal per-user configuration (normally `$HOME/.gitconfig`), but not `.gitconfig` in the repository itself. – torek Apr 16 '18 at 22:45
  • oh heck that might be the problem, will check later – jcollum Apr 16 '18 at 23:19
  • Please update response to let us know whether you were successful – Jesper Rønn-Jensen Oct 27 '18 at 07:40
  • 1
    Sorry this was so long ago and I don't recall ever getting to a resolution :/ – jcollum Oct 30 '18 at 22:53

0 Answers0