The other day I was working on some documentation and wanted to do a simple diff between two word documents. I remembered that Word has a comparison feature. Unfortunately, it has a very clunky file selection dialog and of course you have to extract the older version from git if you want to compare. I knew there had to be a better way.
I put together a bash script (I’m a bash newbie so go easy) to route the diff to the right place depending on the file extension. There’s not a command line option for Word to start the diff so I found a handy script that’s a part of TortoiseSVN to start the compare.
Make sure to edit the default application to your preference. I use WinMerge on an x64 machine, so if you’re in the same boat then no changes required.
I set up everything to be in your $USERPROFILE
folder, which is the same folder where your global .gitconfig
can be found. You’ll also need to update that .gitconfig
file with the following. If you already have a [diff]
section, comment it out or replace it with the one below.
[shell linenumbers=”false”]
[difftool “dynamicdiff”]
cmd = \”C:/Users/your_windows_username/GitDiff.sh\” \”$LOCAL\” \”$REMOTE\”
[diff]
guitool = dynamicdiff
[/shell]
Here are the scripts.