- Requires Java 1.6 or higher.
- Assumes Java is added to PATH (to check open a cmd and run java -version)
- No other platform specific requirements
- A shell script and a bat script are packaged
Just download the zip file.
Extract it anywhere (and optionally you add the bin folder to PATH).
Homebrew makes it easy to install ExcelCompare:
$ brew update
$ brew install excel-compare
-
Create exceldiff.cmd command file anywhere with write permission and add the following to it:
<path-to-the-excel-compare-installation-folder>/bin/excel_cmp $2 $5
e.g.
/usr/local/Cellar/excel-compare/0.6.1/bin/excel_cmp $2 $5Why arguments two and five? It’s because Git passes seven arguments to a diff command, of which the second is the path to the old file (which likely is a temporary file) and the fifth is the path to the new file. For more detailed information, have a look at the Git documentation, specifically under GIT_EXTERNAL_DIFF.
-
Edit the .git/config file in your repository and amend the following path:
[diff "excel"]
command = <path-of-the-command-file-above>
e.g.
[diff "excel"]
command = /usr/local/Cellar/excel-compare/0.6.1/bin/exceldiff.cmd -
Next, we must tell Git to associate certain files with the excel diff driver. To do so, edit .gitattributes in the root of your repository and amend the following:
*.xlsx diff=excel
*.xls diff=excel
Note:
- Git attributes are set either in a .gitattributes file in one of your directories (normally the root of your project) or in the .git/info/attributes file if you don’t want the attributes file committed with your project.
- .gitattributes (unlike .gitignore) must be committed to have any effect, so add it to a commit at this point.
- Compare with HEAD revision
git diff <file_name> - Compare file between 2 commits
git diff <left_commit_id> <right_commit_id> <file_name>
Thank you @mcculley and @stefjoosten for the feedback. I will update the instruction.