logoalt Hacker News

kirtivryesterday at 7:21 PM1 replyview on HN

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.


Replies

Neywinytoday at 12:14 AM

Sadly worktrees do some stuff with the git folder that's made one development environment we inherited incompatible. Something about the .git folder not being a fully real .git folder maybe