logoalt Hacker News

roetlichyesterday at 6:38 PM10 repliesview on HN

Who would have thought that git worktree is the technology of the year 2026?


Replies

kirtivryesterday at 7:21 PM

Yeah, when you had multiple agents working on the same machine, branch isolation was no longer sufficient.

A repository folder can only be on one branch at a time.

A worktree is basically equivalent to a cp -R + git branch, which allows this new workflow to occur.

I loved this particular historical insight as to why `git worktree` was added in 2015:

Before worktrees, kernel devs faced a major inconvenience when switching contexts, e.g., stopping feature work to fix an urgent bug on a release branch.

Running git stash and switching branches alters timestamps on thousands of files.

This forces `make` to perform a full re-compile, which can take up to an hour on large kernels.

show 1 reply
p1neconeyesterday at 10:55 PM

I use a skill that basically boils down to 'keep track of ongoing work in a json file, create a new numbered clone for each separate thread of work, delete when done'. Worktrees are too opaque and not entirely isolated for my liking.

swe_dimayesterday at 9:33 PM

I still don't understand how people use git worktrees with Docker. You need a full database and etc. For me it's simpler to have multiple checkouts.

show 2 replies
mrklolyesterday at 7:29 PM

And the team behind opencode is working on an alternative https://github.com/anomalyco/rift

show 3 replies
baqyesterday at 9:05 PM

How small are people’s projects if they find worktrees useful? I use them for hobby stuff, but $DAYJOB is a different story because of testing

show 2 replies
mohamedkoubaayesterday at 8:58 PM

I set up multiple work trees in one vscode workspace last year and wrote in the agents.md how to merge branches - but I spend about a third of the time helping agents integrate and merge. I remember wishing the tooling would catch up

carterschonwaldyesterday at 8:17 PM

i have some fun experiments i'm doing with full virtualization middle ware of all sys calls for agents tools/shell commands/io, still far from daily driver, but allows me to do a very rich overlay / virtual file system tom foolery in place

parisiansamyesterday at 8:31 PM

I have moved from my own awkward scripts to lazyworktree TUI and I loved it

epolanskiyesterday at 8:39 PM

I can barely keep up with one single thread and branch, go figure.

john_buildsyesterday at 8:56 PM

best tool yet!