# Weave — Entity-Level Git Merge Driver > Weave is an entity-level Git merge driver that merges code by function/class (not lines) to reduce false conflicts in parallel branches and agent edits. ## Install Save the content below to `.claude/skills/` or append to your `CLAUDE.md`: ## Quick Use 1. Install / set up: ```bash brew install weave ``` 2. Start / smoke test: ```bash weave setup ``` 3. Verify: - Run `git config --get merge.weave.driver` and confirm Git is configured to invoke `weave-driver` during merges. ## Intro Weave is an entity-level Git merge driver that merges code by function/class (not lines) to reduce false conflicts in parallel branches and agent edits. - **Best for:** teams running parallel branches (humans or agents) who want fewer merge-conflict interruptions - **Works with:** Git (merge driver), Homebrew or Rust toolchain; common code file types (TS/Python/Go/Rust, etc.) - **Setup time:** 5 minutes ## Practical Notes - Setup time ~5 minutes: install + `weave setup` in one repo - Works across many languages; falls back to normal line-level merge for unsupported file types - GitHub stars/forks (verified) for adoption signal: see Source & Thanks Weave is most useful when your conflicts are *structural*, not truly overlapping: - Two agents edit different functions in the same file. - One branch adds imports while another refactors a nearby block. - A class gets new methods on both sides, but Git still panics because the line context overlaps. A practical rollout pattern: 1. Enable it in one repo first and keep it as a team convention (so merges behave the same in CI and locally). 2. If you don't want to touch `.gitattributes`, start with the per-user setup using `.git/info/attributes`. 3. Keep a “safe revert” habit: `weave unsetup` restores normal Git merging if you hit an edge case. Treat it like a merge accelerator for multi-branch work: it doesn't replace code review, but it reduces the *mechanical* time spent resolving conflicts that were never real. ### FAQ **Q: What is Weave in one sentence?** A: An entity-level Git merge driver that merges code by function/class instead of line diffs. **Q: Is it free?** A: Yes — it's open-source and licensed under an SPDX license listed below. **Q: How do I remove it from a repo?** A: Run `weave unsetup` to revert the merge-driver configuration. ## Source & Thanks > Source: https://github.com/Ataraxy-Labs/weave > License: Apache-2.0 > GitHub stars: 999 · forks: 28 --- ## 快速使用 1. 安装 / 设置: ```bash brew install weave ``` 2. 启动 / 冒烟测试: ```bash weave setup ``` 3. 验证: - 运行 `git config --get merge.weave.driver`,确认 Git 已配置在合并时调用 `weave-driver`。 ## 简介 Weave 是一个“按实体而不是按行”合并的 Git 语义合并驱动:以函数/类为单位合并,减少并行分支与多 Agent 编辑的伪冲突,并在不支持类型上回退到 Git 默认策略,更适合并行开发与代码生成场景。 - **适合谁:** 多人/多 Agent 并行改代码、经常被合并冲突打断的团队 - **可搭配:** Git(merge driver),Homebrew 或 Rust;常见代码文件(TS/Python/Go/Rust 等) - **准备时间:** 5 分钟 ## 实战建议 - 准备时间约 5 分钟:安装后在仓库里执行一次 `weave setup` - 覆盖多语言;不支持的文件类型会自动回退到 Git 的按行合并 - GitHub stars / forks(已核验)作为采用度信号:见「来源与感谢」 Weave 最适合解决“结构上不冲突、但 Git 误判冲突”的场景: - 两个 Agent 分别改同一文件的不同函数; - 一边加 import,一边改附近逻辑,按行 diff 很容易冲突; - 同一个类两侧都新增方法,但行上下文重叠导致 Git 报冲突。 一个更稳妥的落地方式: 1. 先在一个仓库试点,把它当团队约定(避免本地/CI 行为不一致)。 2. 如果不想修改 `.gitattributes`,先走个人维度:用 `.git/info/attributes` 配置。 3. 保持可逆:遇到极端文件格式时用 `weave unsetup` 立即回退到原生 Git。 它更像“合并加速器”:不替代 Code Review,但能显著减少那些本质上不需要人类介入的机械冲突处理。 ### FAQ **一句话解释 Weave 是什么?** 答:一个按函数/类等“实体”合并的 Git merge driver,用来减少伪冲突。 **它免费吗?** 答:免费开源,许可证见下方「来源与感谢」。 **如何卸载/回退?** 答:在仓库里运行 `weave unsetup` 即可回退到原生 Git 合并。 ## 来源与感谢 > Source: https://github.com/Ataraxy-Labs/weave > License: Apache-2.0 > GitHub stars: 999 · forks: 28 --- Source: https://tokrepo.com/en/workflows/weave-entity-level-git-merge-driver Author: Agent Toolkit