git-cow
APFS copy-on-write git worktrees built on github.com/tmc/apple/x/apfs (zero-cgo clonefile(2) + F_LOG2PHYS_EXT extent inspection).
Maintains one hidden per-repository template checkout (.git-cow/<repo>) and CoW-clones both tracked files and ignored build/cache directories (target/, node_modules/, .next/, .turbo/, etc.) into each new worktree. On volumes that do not support APFS cloning (apfs.ErrUnsupported) or with GIT_COW=0, it falls back cleanly to plain git worktree add.
Usage
# Self-contained APFS CoW demo (16 MB build artifact, physical extent sharing proof):
go run ./examples/kernel/git-cow demo
# Install as `git cow` subcommand:
go build -o ~/bin/git-cow ./examples/kernel/git-cow
git cow add -b feat/login
git cow list --shared
git cow warm ~/.worktrees/<repo>/login
git cow remove --warm ~/.worktrees/<repo>/login
git cow cleanup -n
Configuration (git config)
| Key |
Default |
Description |
cow.root |
~/.worktrees |
Default root for add when no path is given (supports ~, {repo}) |
cow.base |
<parent>/.git-cow/<repo> |
Override template checkout path (supports ~, {repo}) |
cow.share |
(empty) |
Extra hidden directories to CoW-clone (multi-valued) |
cow.warmInterval |
1h |
Auto-warm cadence (0, 30m, 1h, never) |
GIT_COW=0 |
(unset) |
Disable CoW cloning and fall back to plain git worktree add |
Safety
remove refuses to remove the main checkout or the internal .git-cow template checkout.
cleanup keeps unmerged, detached, dirty (unless -f), and current-directory worktrees, and saves every deleted branch to refs/git-cow/deleted/<timestamp>/branch/<name> before deleting it.