A macOS tool that creates git worktrees using APFS copy-on-write cloning instead of git checkout. For large monorepos this can be orders of magnitude faster than git worktree add.
go install github.com/orf/git-fast-worktree@latestRun from within a git repository:
# Create a worktree at the given path
git fast-worktree add /tmp/my-worktree
# Create a worktree on a new branch
git fast-worktree add -b my-branch /tmp/my-worktree
# Create a worktree at a specific commit
git fast-worktree add /tmp/my-worktree origin/mainThe CLI mirrors git worktree add flags:
$ git-fast-worktree add --help
Create a worktree using APFS clonefile
Usage:
git-fast-worktree add [flags] <path> [<commit-ish>]
Flags:
-b, --branch string create a new branch
-B, --force-branch string create or reset a branch
-h, --help help for add
--no-track do not set up tracking mode
git worktree add --no-checkoutregisters the worktree with git- Each top-level entry in the source repo (excluding
.git) is cloned into the worktree using the APFSclonefilesyscall, which recursively clones entire directory trees without copying data git reset --no-refreshpopulates the git index to match HEAD
Because clonefile is copy-on-write, the worktree initially shares all data blocks with the source repo and only allocates new storage when files are modified.
- macOS only - relies on the APFS
clonefilesyscall - Same volume only - source and destination must be on the same APFS volume
- Copies the working tree as-is, including untracked and ignored files from the source