I previously wrote about how to get a useful diff for binary Excel files that reside in a Git repository.
This post adds some details that are big enough to deserve a separate post. They are:
- User-level configuration of Excel diffing.
- How to get an Excel diff from
In the previous post, I outlined how to add a diff driver to the
.git/config file in a repository. To make the diff driver available to
all repositories for the current user, update the
%HOME%\.gitconfig in Windows):
[diff "excel"] command = c:/apps/excelcompare/exceldiff.cmd
(See the previous post for path details and Excel Compare.)
To instruct Git to use the excel diff driver for *.xlsx files, edit
$HOME/.config/git/attributes to contain the following:
Note that the location of the user-level gitattributes file can be configured
core.attributesfile setting, so make sure you use the correct
location if you have changed that setting.
git show won't use a custom diff driver. Thus, if you show
a commit you will see the standard "Binary files ... differ" message. To
get a proper diff, use the
$ git show --ext-diff <object>
It might be a good idea to define an alias for
git show that includes
this option, for example:
$ git config --global alias.sh "show --ext-diff"
Feel free to leave a comment below if you found this post useful or if you have questions!