Suture User Guide
What is Suture?
Suture is a version control system with semantic merge for structured files. Unlike Git, which treats files as opaque blobs, Suture understands the internal structure of JSON, YAML, TOML, CSV, XML, and 13 other formats, enabling automatic conflict resolution.
Suture can also be used purely as a Git merge driver — no migration required. Existing Git repos gain semantic merge in a single command.
Quick Start
Installation
# One-line install (Linux / macOS)
curl -fsSL https://raw.githubusercontent.com/WyattAu/suture/main/install.sh | sh
# Cargo
cargo install suture-cli
# Homebrew
brew install WyattAu/suture-merge-driver/suture-merge-driver
# npm (merge driver only)
npm install -g suture-merge-driver
# PyPI (merge driver only)
pip install suture-merge-driver
# Binary download
# https://github.com/WyattAu/suture/releases
Basic Workflow
# Initialize a repository
suture init my-project
cd my-project
# Create and switch branches
suture branch feature/json-config
suture checkout feature/json-config
# Make changes, then commit
suture add config.json
suture commit "update config"
# View history
suture log --oneline --graph
# Merge — conflicts in structured files are resolved automatically
suture merge main
# Compare two branches
suture diff --from main --to feature
# Push/pull to a hub
suture remote add origin http://localhost:50051/my-project
suture push origin
suture pull origin
Structured Merge
When two branches edit different keys in a JSON file, Git reports a conflict. Suture resolves it automatically because it understands JSON structure.
Git output:
<<<<<<< HEAD
"version": "5.1.0",
"features": ["merge", "diff"]
=======
"license": "AGPL-3.0"
>>>>>>> feature
Suture output (automatic):
{
"version": "5.1.0",
"features": ["merge", "diff"],
"license": "AGPL-3.0"
}
This works for all 18 supported formats. Suture detects the format from the file extension and applies the appropriate merge strategy.
Merge strategies:
semantic(default) — try semantic drivers, fall back to conflict markersours— keep our version for all conflictstheirs— keep their version for all conflictsmanual— skip semantic drivers, leave all conflicts as markers
suture merge -s ours feature
suture merge -s theirs feature
suture merge --dry-run feature # preview without modifying working tree
Remote Collaboration
# Add a remote hub
suture remote add origin http://hub.example.com/my-repo
# Authenticate
suture remote login origin
# Push and pull
suture push origin
suture push origin feature # push a specific branch
suture pull origin
suture pull --rebase origin
# Fetch without merging
suture fetch origin
suture fetch --depth 10 origin # shallow fetch
# Clone
suture clone http://hub.example.com/my-repo
suture clone http://hub.example.com/my-repo --depth 10
# List remote branches
suture ls-remote origin
# Mirror a remote
suture remote mirror http://upstream/repo upstream-name
LFS (Large File Storage)
# Track large files by pattern
suture lfs track "*.mp4"
suture lfs track "*.png" --size-limit 5MB
suture lfs track "assets/*"
# Stop tracking
suture lfs untrack "*.mp4"
# List tracked patterns
suture lfs list
# Show LFS object summary
suture lfs status
Merge Driver (Git Integration)
Add semantic merge to an existing Git repo in one line:
curl -fsSL https://raw.githubusercontent.com/WyattAu/suture/main/scripts/install-merge-driver.sh | bash
Or manually:
suture git driver install # install
suture git driver uninstall # remove
suture git driver list # check status
This configures .gitattributes so Git delegates merges of .json, .yaml, .yml, .toml, .xml, and .csv files to Suture.
Supported Formats
.json.yml, .yaml.toml.csv.xml.html, .htm.md, .markdown, .mdown, .mkd.sql.svg.docx.xlsx.pptx.pdf.png, .jpg, .jpeg, .gif, .bmp, .webp, .tiff, .ico, .avif.rss, .atom.ics, .ifb.otio.properties, .iniList available drivers:
suture drivers
Command Reference
Repository Commands
suture init [path]suture clone <url> [dir]suture statussuture log [branch]suture diffsuture show <commit>suture fsckFile Operations
suture add <paths>suture rm <paths>suture mv <src> <dst>suture restore <paths>suture cleansuture grep <pattern>suture blame <path>Branching
suture branchsuture branch <name>suture branch -d <name>suture checkout <branch>suture switch <branch>suture merge <branch>suture rebase <branch>suture tag <name>suture tag -d <name>suture cherry-pick <commit>suture revert <commit>suture squash <n>suture undo [n]suture rollback <commit>Remote
suture remote add <name> <url>suture remote listsuture remote remove <name>suture remote login <name>suture push [remote] [branch]suture pull [remote]suture fetch [remote]suture ls-remote <url>Stash
suture stash push [-m msg]suture stash popsuture stash apply <n>suture stash listsuture stash drop <n>suture stash clearLFS
suture lfs track <pattern>suture lfs untrack <pattern>suture lfs listsuture lfs statusPlatform & Advanced
suture config [key[=val]]suture doctor [--fix]suture key generatesuture verify <ref>suture bisect start <good> <bad>suture worktree add <path>suture tuisuture export <output>suture archive -o <file>suture syncsuture git import <path>suture completions <shell>Integration Guides
GitHub Actions
- uses: WyattAu/suture/.github/actions/merge@main
with:
files: |
package.json
tsconfig.json
base-ref: ${{ github.event.pull_request.base.sha }}
GitLab CI
semantic-merge:
stage: merge
image: ghcr.io/wyattau/suture:latest
script:
- suture merge-file --driver json base.json ours.json theirs.json -o merged.json
VS Code Extension
Install from the VS Code Marketplace:
- Conflict highlighting for structured files
- One-click auto-merge
- Status bar integration
LSP Protocol
The suture-lsp crate implements the Language Server Protocol for editor integration. It provides semantic merge diagnostics and conflict resolution capabilities directly in supported editors.
Self-Hosted Hub
docker compose up -d
# Hub available at http://localhost:8080
See Self-Hosting Guide for Docker, binary, Kubernetes, and systemd deployment options.