SuperAPI AI Directory

mergelock

mergelock is a git-native merge gate tool for detecting semantic conflicts that git itself cannot discover before branches are merged, such as one branch modifying a function signature while another branch adds a call to the old signature, one side deleting a symbol while the other side still uses it, the same function being written twice, and so on. It supports semantic rules for TypeScript, JavaScript (including TSX/JSX), and Python; other languages can still undergo text, add/add, and modify/delete checks. mergelock does not touch the working tree; all computation is based on git merge-tree and tree-sitter parsers, and it can be safely used in pre-push hooks, CI, or invoked by AI coding agents via MCP. It provides a CLI and an MCP server and requires git 2.38 or later.

Open website

About this tool

mergelock is a git-native merge gate tool designed to catch merge conflicts that git itself cannot see, and is particularly suited to collaboration scenarios among parallel AI agent branches.

Purpose: before branches are merged, mergelock check compares two branches and reports semantic conflicts that git will not tell you about, for example: one branch modifies a function signature while another branch adds a call to the old signature; a symbol is deleted on one side but still used on the other; the same function is written twice.

Key capabilities: semantic rules support TypeScript, JavaScript (including TSX/JSX), and Python. Files in other languages still undergo text, add/add, and modify/delete checks. The tool does not touch the working tree; all computation is based on commits, using git merge-tree and tree-sitter parsers, so it can safely run in pre-push hooks, in CI, or be invoked from AI coding agents via MCP.

Usage: mergelock requires git 2.38 or newer (for git merge-tree --write-tree). Multiple installation methods are provided: Homebrew (macOS and Linux), .deb packages for Debian/Ubuntu (amd64 and arm64, requiring a distribution with git 2.38+, such as Debian 12 or Ubuntu 24.04), .rpm packages for Fedora/RHEL (x86_64 and aarch64), Docker (linux/amd64 and linux/arm64, mounting the repository at /repo), GitHub Actions (checking each pull request against the base branch), precompiled binaries (macOS and Linux, amd64 and arm64, downloaded as an archive from the latest release and placed in PATH; on macOS, binaries downloaded via a browser are blocked by Gatekeeper, and the quarantine flag must be cleared once), installation with Go (requires Go 1.25 or newer and a C compiler, because tree-sitter uses cgo; on macOS install the Xcode command line tools, on Debian/Ubuntu install build-essential), or building from source. After installationyou can run mergelock check inside any git repository. Exit codes make it easy to script.

Use cases: suitable for teams using AI coding agents to develop branches in parallel who need to discover semantic conflicts before merging; also suitable for automated scenarios such as CI pipelines and pre-push hooks.

Limitations: semantic rules support only TypeScript, JavaScript (including TSX/JSX), and Python; git 2.38 or later is required; on macOS, binaries downloaded via a browser require clearing the quarantine flag; installing with Go requires a C compiler. For more command reference, .mergelock.yml configuration, JSON output mode, CI and git hook recipes, and how to connect AI agents via MCP, see USAGE.md. Rule behavior is pinned by branch-pair fixtures in testdata/fixtures/*.txtar, where each fixture is a small repository containing a base, two branches, and the expected findings. The license is Apache License 2.0.