git worktree

A command that checks out another branch into a separate folder that shares the same repository, so you can work on two branches at once.

In more detail

git worktree add ../hotfix fix-bug creates a second working tree for fix-bug without disturbing uncommitted work in the first, and git worktree list shows them all. Each branch can be checked out in only one worktree at a time.

Example

git worktree add ../hotfix fix-bug

Related terms

Taught in

References