leostera/git-twig

lightweight git-worktrees for agents

What it solves

Git worktrees are a powerful way to manage multiple branches simultaneously, but they can be incredibly disk-heavy. Creating a new worktree for a large repository often requires copying gigabytes of data. Git Twig solves this by creating "linked" worktrees that share unchanged files with your existing checkout, drastically reducing disk usage and setup time.

How it works

When you run git twig new, the tool creates a new worktree and uses filesystem-level features (like APFS clonefile on macOS, reflink on Linux, or block cloning on Windows) to share file data between checkouts. It verifies every shared file against the commit to ensure integrity. Because it uses "copy-on-write" cloning rather than hard links, editing a file in one worktree never affects another. If your filesystem doesn't support these advanced sharing features, Twig automatically falls back to standard Git worktree commands.

Who it’s for

This tool is designed for developers and coding agents that need to maintain multiple active branches or experimental checkouts without wasting massive amounts of disk space. It is particularly useful for those working with large codebases like the Linux kernel or documentation sets.

Highlights

  • Dramatically reduces disk footprint, often by 10x to 100x depending on the repository size.
  • Works seamlessly with standard Git tools, editors, and build systems.
  • Supports macOS (APFS), Linux (XFS, Btrfs), and Windows (ReFS/Dev Drive).
  • Includes an adopt command to reorganize existing worktrees into a shared sibling layout.
  • Provides a specific "skill" output to help coding agents manage their own checkouts efficiently.

Related

  • Project
  • Project
  • Project
  • Project