Advanced

How to use git worktree

Work on multiple branches simultaneously without stashing.

Add a worktree
git worktree add ../hotfix hotfix-branch

Creates a new working directory at ../hotfix checked out to hotfix-branch.

When to use: Working on a hotfix while keeping your current feature branch intact — no stashing needed.

List worktrees
git worktree list

Shows all active worktrees and their branches.

Remove a worktree
git worktree remove ../hotfix

Removes the worktree directory and cleans up references.

← Back to Git Reference