Skip to content
Back to search

git-graft

Run hundreds of coding agents on one repository without filling your disk. A faster, lighter replacement for git worktree.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/mprync--git-graft/badge.svg)](/listings/mprync--git-graft)

HTML

<a href="/listings/mprync--git-graft"><img src="/api/listings/mprync--git-graft/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

These steps run a script from the network that findsafeskills does not scan.

macOS and Linux:

curl -fsSL https://raw.githubusercontent.com/mprync/git-graft/main/install.sh | sh

Homebrew:

brew install mprync/tap/git-graft

Windows (PowerShell):

irm https://raw.githubusercontent.com/mprync/git-graft/main/install.ps1 | iex

Scoop:

scoop bucket add mprync https://github.com/mprync/scoop-bucket
scoop install git-graft

Cargo:

cargo install --locked git-graft

There are also `.deb`, `.rpm`, `.apk` and Arch packages on the [releases page](https://github.com/mprync/git-graft/releases), and winget (`winget install mprync.git-graft`) and Chocolatey (`choco install git-graft`) packages once their reviews finish. git-graft needs Git 2.46 or newer. The install scripts verify every download against the release checksums; see [installation](docs/install.md) for upgrades, uninstalling and verifying provenance.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 183 lines · 2 findings marked
  1. <div align="center">
  2. # git-graft
  3. Run hundreds of coding agents on one repository without filling your disk.
  4. [![CI](https://github.com/mprync/git-graft/actions/workflows/ci.yml/badge.svg)](https://github.com/mprync/git-graft/actions/workflows/ci.yml)
  5. [![Release](https://img.shields.io/github/v/release/mprync/git-graft)](https://github.com/mprync/git-graft/releases)
  6. [![crates.io](https://img.shields.io/crates/v/git-graft)](https://crates.io/crates/git-graft)
  7. [![MSRV: Rust 1.89](https://img.shields.io/badge/MSRV-Rust%201.89-orange.svg)](https://www.rust-lang.org)
  8. [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
  9. <picture>
  10. <source media="(prefers-color-scheme: dark)" srcset="docs/assets/scale.dark.svg">
  11. <img alt="100 checkouts of the same repository: git worktree uses 2.8 GiB, git graft uses 27.8 MiB, 99.0% less" src="docs/assets/scale.light.svg" width="520">
  12. </picture>
  13. </div>
  14. git-graft is a faster, lighter alternative to `git worktree`. It gives each task, or each coding agent, its own complete Git repository next to your checkout. Unchanged files share their disk blocks with your checkout, so a graft stores only what you change, and installed dependencies are shared instead of installed again. Agents such as Claude Code, Codex and Cursor use it through a built-in MCP server.
  15. ## Installation
  16. macOS and Linux:
  17. ```sh
  18. curl -fsSL https://raw.githubusercontent.com/mprync/git-graft/main/install.sh | sh
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 27 on GitHub
  19. ```
  20. Homebrew:
  21. ```sh
  22. brew install mprync/tap/git-graft
  23. ```
  24. Windows (PowerShell):
  25. ```powershell
  26. irm https://raw.githubusercontent.com/mprync/git-graft/main/install.ps1 | iex
  27. ```
  28. Scoop:
  29. ```powershell
  30. scoop bucket add mprync https://github.com/mprync/scoop-bucket
  31. scoop install git-graft
  32. ```
  33. Cargo:
  34. ```sh
  35. cargo install --locked git-graft
  36. ```
  37. There are also `.deb`, `.rpm`, `.apk` and Arch packages on the [releases page](https://github.com/mprync/git-graft/releases), and winget (`winget install mprync.git-graft`) and Chocolatey (`choco install git-graft`) packages once their reviews finish. git-graft needs Git 2.46 or newer. The install scripts verify every download against the release checksums; see [installation](docs/install.md) for upgrades, uninstalling and verifying provenance.
  38. ## Getting started
  39. Create a graft from any Git checkout:
  40. ```sh
  41. git graft add fix-parser
  42. ```
  43. It prints the graft's `path` and a `lease`, a secret that proves the graft is yours. Keep the lease out of logs.
  44. Work in the graft like any other repository:
  45. ```sh
  46. cd ../myrepo.graft/fix-parser
  47. git commit -am "Fix the parser"
  48. ```
  49. When you're done, merge it into `main` from your checkout:
  50. ```sh
  51. git graft merge fix-parser --lease <lease>
  52. ```
  53. Merging archives the graft rather than deleting it, and returns a `recovery_lease`; `git graft restore fix-parser --lease <recovery_lease>` brings it back. Use `--into <branch>` to merge somewhere else, and `git graft list` to see every graft.
  54. ### Sharing dependencies
  55. Install your dependencies once in your checkout and share them:
  56. ```sh
  57. npm ci
  58. git graft deps share --key node24
  59. ```
  60. Every graft you create afterwards gets a writable `node_modules` that takes almost no extra space, without running `npm ci` again.
  61. ## Using it with coding agents
  62. git-graft includes an MCP server. Give your agent the path to your repository.
  63. Claude Code:
  64. ```sh
  65. claude mcp add git-graft -- git-graft --repo /path/to/project mcp
  66. ```
  67. Codex, in `~/.codex/config.toml`:
  68. ```toml
  69. [mcp_servers.git-graft]
  70. command = "git-graft"
  71. args = ["--repo", "/path/to/project", "mcp"]
  72. ```
  73. Cursor, in `.cursor/mcp.json`:
  74. ```json
  75. {
  76. "mcpServers": {
  77. "git-graft": {
  78. "command": "git-graft",
  79. "args": ["--repo", "/path/to/project", "mcp"]
  80. }
  81. }
  82. }
  83. ```
  84. Any other MCP client works the same way: a stdio server whose command is `git-graft` with the arguments `--repo <path> mcp`. Add `--allow-exec` after `mcp` to let agents run commands and install packages inside their grafts.
  85. Each agent creates, works in and merges its own graft, and proves ownership with its lease, so agents can't interfere with each other or with your checkout. The [agent guide](skills/git-graft/SKILL.md) describes the tools.
  86. ## Benchmarks
  87. <p align="center">
  88. <picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/disk.dark.svg"><img alt="Disk per checkout: git worktree 28.6 MiB, git graft 0.29 MiB, 98.9% less" src="docs/assets/disk.light.svg" width="49%"></picture>
  89. <picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/dependencies.dark.svg"><img alt="node_modules per checkout: git worktree 85.4 MiB, git graft 0.16 MiB, 99.8% less" src="docs/assets/dependencies.light.svg" width="49%"></picture>
  90. <picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/speed.dark.svg"><img alt="Ready to work: git worktree 550 ms, git graft 454 ms, 17% faster" src="docs/assets/speed.light.svg" width="49%"></picture>
  91. <picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/speed-dependencies.dark.svg"><img alt="Ready to test with node_modules: git worktree 742 ms, git graft 237 ms, 3.1 times faster" src="docs/assets/speed-dependencies.light.svg" width="49%"></picture>
  92. </p>
  93. These are medians from the release build on macOS with APFS, comparing `git worktree add` (plus `npm ci` where dependencies are involved) with `git graft add` on the same repositories. In very small repositories, under about two thousand files, a worktree is still quicker to create, but the disk savings hold at every size. The [benchmarks page](docs/benchmarks.md) has the method, the raw data and how to rerun each one.
  94. ## Supported platforms
  95. git-graft runs on macOS, Linux and Windows. Disk sharing needs a filesystem that can clone files: APFS on macOS, or Btrfs and XFS on Linux. On ext4 and NTFS grafts still work, with private repositories, merging, archives and the MCP server, but their files are full copies, as with a worktree. Run `git graft doctor` to see what your filesystem supports.
  96. ## How it works
  97. `git graft add` creates a standalone Git repository next to your checkout and asks the filesystem to clone its files instead of writing them. The clones share data blocks with your checkout until you edit them. A graft mirrors your checkout: before reusing a file, git-graft proves that Git's own line-ending conversion of it, the one `git status` and `git add` apply, gives exactly the committed content, using Git's own index check or a hash of the converted bytes. The graft keeps your checkout's line endings, and Git in the graft agrees every file is unchanged. Files with a filter, `ident` or a working-tree encoding, and anything git-graft cannot prove, come from Git. It also records each file's metadata in the new index, so the first `git status` reads no file contents.
  98. Creating a graft never changes your checkout, and never copies untracked or ignored files into the graft. Merging reports conflicts before it changes anything, and `merge`, `remove` and `prune` archive a graft instead of deleting it. See [safety and recovery](docs/safety.md) for the details.
  99. ## FAQ
  100. **How is this different from `git worktree`?**
  101. A worktree writes a full copy of every file, shares your repository's object store, refs and stash, and allows one checkout per branch. A graft is a standalone repository with its own objects, branches, reflog, stash and index, so any branch name works and your repository isn't written to while the graft is in use. On a filesystem that can clone files, it stores only the files you change.
  102. **Why not `cp -c` or `cp --reflink`?**
  103. Cloning a directory copies everything in it, including untracked and ignored files, local edits and Git's internal state, and nothing checks the files against a commit. A graft starts from the commit you choose, leaves untracked and ignored files behind, verifies every reused file, and adds merging, archives and the MCP server.
  104. **Why not `git clone --shared` or `--reference`?**
  105. Both borrow Git objects from the original repository but still write every working file in full, and the clone breaks if the original's objects move or are garbage-collected. A graft shares file data through the filesystem and keeps its own snapshot of the objects it needs.
  106. **What about Jujutsu workspaces?**
  107. They need `jj` and write a full working copy for each workspace. git-graft works with plain Git and the tools you already use.
  108. **Is my work safe if something crashes?**
  109. Every operation can be retried after an interruption, and archived grafts can be restored. Archives are not backups, so keep your own backups for disk failure. See [safety and recovery](docs/safety.md).
  110. ## Documentation
  111. - [Installation](docs/install.md)
  112. - [Commands, merging and recovery](docs/operations.md)
  113. - [Grafts and dependency sharing](docs/workspaces.md)
  114. - [Safety and recovery](docs/safety.md)
  115. - [Benchmarks](docs/benchmarks.md)
  116. - [Agent guide](skills/git-graft/SKILL.md)
  117. Every command also has `--help`, and `git graft --help` shows the full manual.
  118. ## Contributing
  119. Bug reports and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) to build git-graft and run its tests, and [SECURITY.md](SECURITY.md) to report a vulnerability privately.
  120. ## License
  121. git-graft is released under the [MIT license](LICENSE).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.