Skip to main content

Git merge driver that semantically merges JSON, YAML, TOML, CSV, XML, Markdown, DOCX, XLSX, PPTX, and more

Project description

suture-merge-driver

A Git merge driver that semantically merges structured files — JSON, YAML, TOML, CSV, XML, Markdown, DOCX, XLSX, PPTX, and more — instead of falling back to noisy line-based conflict markers.

Install

pip install suture-merge-driver

Requires Python >= 3.8. On install, the appropriate platform binary is downloaded automatically from GitHub Releases.

Configure Git

git config merge.suture.name "Suture semantic merge"
git config merge.suture.driver "suture-merge-driver %O %A %B %P"
echo "*.json merge=suture" >> .gitattributes
echo "*.yaml merge=suture" >> .gitattributes
echo "*.yml merge=suture" >> .gitattributes

Add more file types as needed:

echo "*.toml merge=suture" >> .gitattributes
echo "*.xml merge=suture" >> .gitattributes
echo "*.csv merge=suture" >> .gitattributes
echo "*.md merge=suture" >> .gitattributes

How it works

When a merge conflict occurs on a configured file, Git invokes suture-merge-driver %O %A %B %P:

  • %O — the base (ancestor) version
  • %A — ours (your changes) — Git reads the result from here
  • %B — theirs (their changes)
  • %P — the original file path (used to detect format)

Suture parses both sides at the semantic level, applies a three-way merge, and writes the resolved result back. If the merge succeeds, Git uses the result. If not, Git falls back to its default conflict behavior.

Before — line-based merge

<<<<<<< ours
{
  "database": {
    "host": "db.prod.example.com",
    "port": 5432,
    "ssl": true
  },
  "logging": {
    "level": "warn"
  }
}
=======
{
  "database": {
    "host": "db.prod.example.com",
    "port": 5432,
    "max_connections": 100
  },
  "logging": {
    "level": "info",
    "format": "json"
  }
}
>>>>>>> theirs

After — semantic merge

{
  "database": {
    "host": "db.prod.example.com",
    "port": 5432,
    "ssl": true,
    "max_connections": 100
  },
  "logging": {
    "level": "info",
    "format": "json"
  }
}

Both sets of changes are merged cleanly — no conflict markers, no manual resolution.

Supported formats

Format Extensions
JSON .json
YAML .yaml, .yml
TOML .toml
CSV .csv
XML .xml
Markdown .md, .markdown
DOCX .docx
XLSX .xlsx
PPTX .pptx

Development

When developing locally, the driver automatically uses the Rust binary at ../../target/release/suture if it exists. Build it with:

cargo build --release

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

suture_merge_driver-5.0.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

suture_merge_driver-5.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file suture_merge_driver-5.0.0.tar.gz.

File metadata

  • Download URL: suture_merge_driver-5.0.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for suture_merge_driver-5.0.0.tar.gz
Algorithm Hash digest
SHA256 2d0ecb26733fddecd1ce7468cdc307669a2ce30216ee22810db465d9ed6cca6e
MD5 24582af3617c9f68598e2209cf6a5074
BLAKE2b-256 43179321bfe8346cde6a6e588d0e45f367ec770823a25245833514741bd9b2d8

See more details on using hashes here.

File details

Details for the file suture_merge_driver-5.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for suture_merge_driver-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbb05d591fc73ce96306b5212dfd412216ced7d64bdd421917a253344595aa6b
MD5 66205597e43db54c0fb00b8b285f38bf
BLAKE2b-256 672854e0a5c54d9c8959c36902eaa6273b943b51711f78e5bfe6e3044c0f7b42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page