Integrating with Git
Araxis Merge integrates tightly with Git. Araxis
provides a Git File-System Plugin to enable Merge to access files in Git depots
directly. For file comparisons (but not folder comparisons), Merge is also able
to populate the Versions button drop-down versions menu with other
revisions of each file being compared. For more information, see
Comparing Text Files (or Typed/Pasted Text).
Integration with Git requires the Professional Edition of Merge to enable the comparison of two modified versions of a file with their common ancestor.
Git can also be configured to use Merge for file comparison and merge operations.
The following configuration steps have been tested with Git v2.24.0.
To use Araxis Merge for file comparison and file merging:
Ensure that the command-line utilities have been installed as described in the Installing the Merge command-line utilities section of the How to Install topic.
-
Update the Git configuration file by adding the following diff and merge tool configurations:
[diff] tool = araxis [merge] tool = araxis [alias] ad = difftool --tool=araxis --dir-diff ads = difftool --tool=araxis --dir-diff --staged
To compare files, use the
git difftool
command. The--dir-diff
option can be provided, in which case a folder comparison will be opened showing all the changed files.The git
ad
(short for Araxis diff) andads
(Araxis diff stage) aliases defined above provide convenient shortcuts to invoke Merge via thegit difftool
command. See Examples of using the gitad
andads
aliases for usage.To resolve conflicting changes after merging files from a branch or remote repository, use the
git mergetool
command.When Merge is opened via
git mergetool
, the files being compared are automatically merged as described in the Automatic File Merging topic. Changes that overlap or touch at their start or end are marked as conflicts. A red conflict iconis shown at the beginning of each line within a change that could not be automatically merged.
If you wish to see the files as they were prior to the automatic merge, simply click Undo
or press Cmd+Z.
Examples of using the git ad and ads aliases:
The git difftool
command is a frontend to git diff
and thus accepts git diff
options and arguments. As the Git ad
and ads
aliases defined in the above configuration are simply shortcuts for invoking git difftool
, this means that you can in general pass git diff
arguments to git ad
and git ads
. The examples below show some possibilities, but are by no means exhaustive.
The documentation on specifying Git revisions and ranges may also be helpful when considering how best to invoke git ad
.
-
Launch a two-way folder comparison to show all the unstaged changes within the current working tree:
git ad
-
Launch a two-way folder comparison to show all the staged changes within the current index (staging area):
git ads
-
Launch a two-way folder comparison showing the changes to a modified file
myfile.c
:git ad myfile.c
-
Launch a two-way folder comparison of commits 11a783 and c2061b of
myfile.c
:git ad 11a783..c2061b myfile.c
-
Launch a two-way folder comparison to show all the changes applied by the commit with hash
c2061b
:git ad c2061b^!
If you are using
zsh
as your shell and have theEXTENDEDGLOB
option set, you will need to escape the^
:git ad c2061b\^!
-
Launch a two-way folder comparison to show all the changes between the
master
andbugfix
branches:git ad master..bugfix