Merge Integration with Git
Merge can be configured as a custom merge driver for Git, allowing Git to invoke Merge automatically when merging XML files instead of using Git's built-in line-based merge.
Configuration
Step 1: Configure the Git merge driver globally
Add the following to your Git global configuration (~/.gitconfig):
[merge "deltanova-merge"]
name = deltanova XML Merge driver
driver = java -jar /path/to/deltanova-merge-x.y.z.jar merge concurrent \
ancestor %O local %A remote %B result.xml && cp result.xml %A
recursive = binary
Replace /path/to/ with the actual path to your Merge JAR file.
Step 2: Configure the attributes file
Create or update the .gitattributes file in your repository root to associate XML files with the merge driver:
*.xml merge=deltanova-merge
*.dita merge=deltanova-merge
*.ditamap merge=deltanova-merge
How It Works
When Git needs to merge an XML file:
-
Git calls the merge driver with the ancestor (
%O), local (%A), and remote (%B) versions. -
Merge performs a concurrent merge of the three versions.
-
The result is written back to the local file (
%A) that Git uses as the merge output. -
If the merge is clean (no conflicts), Git marks it as resolved.
-
If conflicts remain (Merge leaves conflict markers via DeltaV2 attributes), Git marks the file as conflicted.
Viewing Merge Results
The merge output is a DeltaV2 XML file. To view it in a human-readable form, use the ANALYZED_DELTAV2 or SIMPLIFIED_DELTAV2 result type.
Notes
-
The
%O,%A,%Bplaceholders are provided by Git and represent the ancestor, local, and remote versions respectively. -
The merge driver must produce a non-zero exit code to signal a merge conflict to Git.
-
The initial release of the Merge REST API does not support formatting elements.