Skip to content
Dev Tools Article

Ditching Line Diffs for AST-Based Git Merges with Weave

Weave replaces Git's line-level merge driver with tree-sitter parsing to resolve semantic conflicts automatically.

Lenn Voss
Lenn Voss
Cloud & Infrastructure Writer · Jun 15, 2026 · 3 min read

Every developer knows the sudden drop in their stomach when a routine git merge halts with a wall of red conflict markers. You open the file, expecting a complex architectural clash, only to find that two people simply touched different functions in the same file. Standard Git, for all its brilliance, is fundamentally blind to code structure. It sees lines of text, not syntax trees.

Enter Weave, an open-source entity-level semantic merge driver designed to replace Git's line-by-line diffing with syntax-aware merging. By parsing code into Abstract Syntax Trees (ASTs), Weave understands when changes are isolated to distinct functions or classes, resolving what would otherwise be painful, spurious conflicts.

Moving Beyond Line-by-Line Diffs

Traditional Git relies on line-level diffing algorithms (like the default 'ort' strategy) to determine if two branches conflict. If two developers modify lines that sit close to one another—or if an AI agent inserts a new helper function right next to a modified method—Git often panics and throws a conflict because the lines physically overlap in the file.

Weave bypasses this limitation by operating at the entity level. Powered by sem-core and Tree-sitter, Weave parses source code into structured syntax trees. Instead of seeing lines 45 through 60 as a generic block of text, Weave recognizes them as a specific function or class. If Developer A modifies an existing function and Developer B adds a new function right below it, Weave matches the entities, applies the changes to their respective nodes, and merges the file cleanly without throwing a conflict.

The Three-Layer Architecture

Weave is structured into three distinct layers, scaling from a drop-in local tool to a collaborative, AI-ready workflow:

  • MERGE (The Merge Driver): This is the core engine. It acts as a direct replacement for Git's native merge driver. By analyzing code by function and class rather than line numbers, it eliminates the vast majority of overlapping-line conflicts.
  • COORDINATE (CRDT State): For multi-agent or highly collaborative environments, Weave introduces a Conflict-Free Replicated Data Type (CRDT) coordination layer. This allows agents or developers to "claim" specific code entities before editing them, catching potential conflicts before they are even committed.
  • CONNECT (MCP Server): To support modern AI-driven development, Weave exposes 15 tools via the Model Context Protocol (MCP). This enables LLM agents, such as Claude, to call Weave's semantic tools directly, ensuring AI-generated code integrates smoothly without breaking existing structures.

Language Support and Real-World Benchmarks

A semantic merge tool is only as good as its parser support. Weave supports 28 languages and 5 data formats out of the box. The language roster covers mainstream staples and specialized systems languages alike, including TypeScript, JavaScript, Python, Go, Rust, Java, C, C++, C#, Ruby, PHP, Swift, Kotlin, Elixir, Bash, HCL, Fortran, Dart, Perl, OCaml, Scala, and Zig, alongside frontend frameworks like Vue and Svelte. Supported data formats include XML, ERB, JSON, YAML, TOML, CSV, and Markdown.

In terms of reliability, Weave's creators put the driver through rigorous testing, including 4,917 file merges. Across 31 distinct merge scenarios spanning 7 languages, the tool achieved a 100% success rate (31/31). For comparison, the popular semantic tool mergiraf resolved 26 out of 31 (83%), while standard Git managed only 15 out of 31 (48%).

Crucially for production environments, Weave reports 83 real-world wins and zero regressions across C, Python, and Go codebases.

Getting Started with Weave

Integrating Weave into an existing workflow is designed to be low-friction. It installs via Homebrew and configures itself with a single command:

brew install weave
cd my-project
weave setup

Once configured, Weave registers itself as the local Git merge driver. The next time a merge is initiated, Git delegates the heavy lifting to Weave. If the entities match and don't overlap semantically, the merge completes automatically under the hood, leaving developers to focus on writing code rather than resolving git conflicts.

Sources & further reading

  1. Weave: Merging based on language structure and not lines — ataraxy-labs.github.io
Lenn Voss
Written by
Lenn Voss · Cloud & Infrastructure Writer

Lenn writes about cloud platforms, Kubernetes internals, and the infrastructure decisions that quietly make or break engineering organizations. Based in Berlin's vibrant tech scene, they have a talent for turning dense platform-engineering topics into prose that people actually finish reading.

Discussion 0

Join the discussion

Sign in or create an account to comment and vote.

No comments yet

Be the first to weigh in.

Related Reading