git worktree is a Git feature that allows you to check out multiple branches at once in different directories, without cloning the repository again
Worktrees are kind of like an alternative to stash. This lets you truly multitask, having different branches in different locations.
Here are a few use cases for git worktree
The command is git worktree add <location> <name>
You can place the worktree wherever you want, but it has to be outside of the current directory so it's not tracked, e.g.
git worktree add .worktrees/<repo>/bug/fix-bar bug/fix-bar
or
git worktree add ../my-repo-v5 master-v5
Your worktrees are denoted with a plus (+) when using a command like git branch.
There's of course a git worktree list and a git worktree remove
I personally keep everything in code/worktrees/<worktree>, and name it as <repo>-<branch> more or less. This is done through gwt, gwta aliases.
With the rise of [[20250811123613-agentic-ai]], worktrees can be even more useful, having agents act in different directories simultaneously.