Araxis Merge: The Complete Guide to File and Folder Comparison

How to Automate Three-Way Merges Using Araxis Merge

Overview

Automating three-way merges with Araxis Merge lets you resolve common merge conflicts and integrate changes from two branches with a common ancestor programmatically. Below is a practical, step-by-step guide covering CLI usage, scripting examples, integration with git, and tips for automation-friendly workflows.

Requirements

  • Araxis Merge installed (supports command-line operations).
  • Git (or another VCS) for branch management.
  • A scripting environment (bash, PowerShell, Python) on the machine where automation will run.

1) Command-line basics

Araxis Merge provides a command-line tool (typically called Compare on Windows or araxis/merge on other platforms — check your installation). Use these flags for three-way merges:

  • Launch three-way merge with files: Compare /3 way: Compare file-base file-left file-right /merge /output:file-result
  • Silent/automated options vary by platform; consult your local CLI help (Compare /?) to confirm exact flag names on your version.

2) Automating with Git (recommended flow)

  1. Identify the common ancestor and the two branch tips:
    • base: git merge-base branchA branchB
    • left (ours): git rev-parse branchA
    • right (theirs): git rev-parse branchB
  2. Export the specific file versions to temporary paths:
    • git show :path/to/file > /tmp/file-base
    • git show :path/to/file > /tmp/file-left
    • git show :path/to/file > /tmp/file-right
  3. Run Araxis Merge in automated merge mode:
    • Example (pseudocode; adapt flags to your installation):

      Code

      Compare /3 /merge /output:/tmp/file-merged /silent /wait /result:accept /log:/tmp/merge.log /close file-base file-left file-right
  4. If merge completes without conflicts, replace the working copy file with /tmp/file-merged and commit.
  5. If manual intervention required, Araxis will present a UI — automation should detect non-zero exit codes or log entries to pause and notify a human.

3) Example scripts

  • Bash (Linux/macOS; adjust CLI name/flags):

    Code

    #!/bin/bash base=\((git merge-base "\)1” “\(2") tmpdir=\)(mktemp -d) git show \({base}:\)3 > \(tmpdir/base git show \)1:\(3 > \)tmpdir/left git show \(2:\)3 > \(tmpdir/right Compare \)tmpdir/base \(tmpdir/left \)tmpdir/right /merge /output:\(tmpdir/merged /silent if [ \)? -eq 0 ]; thenmv \(tmpdir/merged \)3 git add \(3 git commit -m "Auto-merged \)3 from \(1 and \)2” else echo “Merge needs manual resolution: \(tmpdir" fi </code></div></div></pre> </li> <li>PowerShell (Windows): ``` \)base = git merge-base \(args[0] \)args[1] \(tmp = New-Item -ItemType Directory (Join-Path \)env:TEMP ([guid]::NewGuid().Guid)) git show “\(base:\)args[2]” > (Join-Path \(tmp.FullName 'base') git show "\)args[0]:\(args[2]" > (Join-Path \)tmp.FullName ‘left’) git show “\(args[1]:\)args[2]” > (Join-Path \(tmp.FullName 'right') & 'C:\Program Files\Araxis\Araxis Merge\Compare.exe' (Join-Path \)tmp.FullName ‘base’) (Join-Path $tmp.FullName ‘left’) (Join-Path

Comments

Leave a Reply