1 min read

Work on multiple branches simultaneously with git worktree


No more stashing

Create a worktree for a branch:

worktree_add.sh
git worktree add ../hotfix-branch hotfix/urgent-fix

This checks out hotfix/urgent-fix in ../hotfix-branch so you can work on it without leaving your current branch.

List active worktrees:

worktree_list.sh
git worktree list

Remove a worktree when done:

worktree_remove.sh
git worktree remove ../hotfix-branch

Create a new branch in a worktree:

worktree_new.sh
git worktree add -b feat/new-feature ../new-feature