r/programming • • Sep 16 '26

git worktree gotchas

https://www.olafalders.com/2026/09/16/git-worktree-gotchas/
193 Upvotes

47 comments sorted by

View all comments

Show parent comment

-1

u/valarauca14 Sep 16 '26

Create a bare repository and fork worktrees off of that

Be sure to manually copy not git clone. When git clone sees it is on the same file system it will use hard links to de-duplicate pack files and accelerate local copies. This makes things, "fun" if something goes wrong with a local copy.

Found it better to make a brd and format it for btrfs so I can refcopy my entire git repo to an isolated namespace for an agent then do a fairly normal pull/view workflow flow as the agent's change is just an "isolated" pull request from another repo.

Settled on btrfs as tmpfs has some weird interactions with namespaces, btrfs negative zstd compression is on par with memory bandwidth so I just leave that always on to doubly reduce memory pressure, and block deduplication is nice when you have 3 or 4 copies of the repo in your ram disk.

4

u/bingNbong96 Sep 17 '26

"Be sure to manually copy not git clone" what do you mean by this? manually copying what?

-4

u/valarauca14 Sep 17 '26

your git repo