Git worktrees for agents. More branches, less disk.
open sourceMITself-hostablefree
git twig is a Git subcommand (git twig new) that creates ordinary linked Git worktrees from copy-on-write clones of the files in a nearby worktree, so many checkouts of the same repository share disk blocks instead of each holding a full copy. It uses APFS clonefile on macOS and FICLONE reflinks on Linux Btrfs and reflink-enabled XFS, verifies every cloned file against the requested commit, and lets Git write anything it can't clone; on filesystems without reflinks it falls back to stock git worktree. The README's benchmarks show new worktrees using from 2x to over 150x less additional disk than git worktree. It ships a skill for coding agents (git twig skill), and an unreleased adopt command moves existing worktrees into a sibling layout and, on macOS, compacts matching files into clones.
Problems it solves
- every git worktree my coding agents create is another full copy of the repo on disk
- ten parallel agent checkouts of a big monorepo are eating my laptop's SSD
- make new git worktrees share unchanged files with copy-on-write instead of duplicating them
- create a worktree for a feature branch that takes almost no extra disk space on APFS
- use reflinks on Btrfs or XFS so extra checkouts of the same repository are nearly free
- tell my coding agent how and where to create worktrees for each task without hand-holding
- my existing worktrees are scattered inside the main clone and I want them moved beside it safely
- reclaim space from old worktrees that hold identical copies of the same files
- a worktree tool that checks cloned files really match the commit before handing the checkout over
Features
- git twig new: linked worktrees built from copy-on-write file clones
- APFS clonefile on macOS; FICLONE on Btrfs and reflink-enabled XFS on Linux
- verifies cloned files against the requested commit; writes are private, never hardlinked
- reuses matching files from nearby worktrees across different revisions (0.5.0)
- falls back to stock git worktree on filesystems without clone support
- handles common LF checkout policies and builtin ident/encoding conversions
- bundled skill for coding agents: git twig skill
- adopt: moves existing worktrees into a sibling layout, with a dry run (unreleased)
- offline compaction on macOS replaces matching files in existing worktrees with clones (unreleased)
- TWIG_TRACE=1 shows which backend each create used
Limitations
- Doesn't save disk on ext4 or other filesystems without reflinks: there it falls back to stock git worktree1
- Doesn't copy uncommitted changes or ignored files into a new worktree: it checks out committed files only1
- Doesn't manage agent sessions or replace an agent app's own built-in worktree creation1
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what git twig does.
- PwrGit Git for people working alongside an agent
- Worktrunk A CLI for Git worktree management, designed for parallel AI agent workflows
- gtr (Git Worktree Runner) A portable Git worktree CLI for PR reviews, coding agents, and repeatable per-branch setup
- CCManager Coding Agent Session Manager for Claude Code / Gemini CLI / Codex CLI / Cursor Agent / Copilot CLI / Cline CLI / OpenCode / Kimi CLI