How to Integrate the File Comparison Tool with Git
The file comparison tool can be integrated with Git clients. It requires that you configure your .gitconfig file and then you can simply start the tool from the command line.
To integrate the Compare Files tool with your Git client, follow this procedure:
- Use one of the following methods to instruct your Git client to use the Oxygen
Compare Files tool:
- Manual Configuration - Locate your Git user-specific configuration file
(.gitconfig) and edit it with a text editor (for example, in
Windows, the .gitconfig file is most likely located in your user
home directory). Add (or replace) the following
lines:
[diff] tool = oxygendiff [merge] tool = oxygendiff [difftool "oxygendiff"] cmd = '[pathToOxygenInstallDir]/diffFiles.exe' -ext $REMOTE $LOCAL $LOCAL [mergetool "oxygendiff"] cmd = '[pathToOxygenInstallDir]/diffFiles.exe' -ext $LOCAL $REMOTE $BASE $MERGED trustExitCode = true [difftool] prompt = false
Note: For Mac OS X, the cmd lines would start with something like: sh "/Applications/Oxygen XML Editor/diffFiles.sh". For Linux, the cmd lines would start with something like: sh "/Oxygen XML Editor/diffFiles.sh". - Command Line Configuration - To automatically configure the
.gitconfig file, you can run the following commands from a
command
line:
git config --global diff.tool oxygendiff git config --global difftool.oxygendiff.cmd '[Oxygen install dir]/diffFiles.exe -ext $REMOTE $LOCAL $LOCAL' git config --global merge.tool oxygendiff git config --global mergetool.oxygendiff.cmd '[Oxygen install dir]/diffFiles.exe -ext $LOCAL $REMOTE $BASE $MERGED' git config --global mergetool.oxygendiff.trustExitCode true
Note: For Mac OS X, the Oxygen file comparison tool would be specified in the second and fourth commands with something like: sh "/Applications/Oxygen XML Editor/diffFiles.sh". For Linux, it would be something like: sh "/Oxygen XML Editor/diffFiles.sh".
- Manual Configuration - Locate your Git user-specific configuration file
(.gitconfig) and edit it with a text editor (for example, in
Windows, the .gitconfig file is most likely located in your user
home directory). Add (or replace) the following
lines:
- To start the Compare Files tool and see a comparison of changes
for a particular file, run the following command from a command
line:
git difftool [PathToFile]
Tip: If the file you want to compare has conflicts, you can start the Compare Files tool as a merge conflict resolution tool by running the following command:git mergetool [PathToFile]
For more information about the Git difftool syntax, see https://git-scm.com/docs/git-difftool.
For more information about the Git mergetool syntax, see https://git-scm.com/docs/git-mergetool.