Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Worktrees

CREATE

Create a worktree for an existing branch using the same name as the working directory

git worktree add path/to/folder/<existing-branch-name>

Create a worktree for an existing branch using a different name than the working directory

git worktree add path/to/folder/ <existing-branch-name>

Create a worktree with a new branch using the same name as the working directory

git worktree add -b <new-branch-name> path/to/folder/<new-branch-name>

Create a worktree with a new branch using a different name than the working directory

git worktree add -b <new-branch-name> path/to/folder/

VIEW

Show all worktrees

git worktree list

DELETE

Remove a worktree

git worktree remove path/to/folder/

or (link)

rm -rf path/to/worktree
git worktree prune
git branch -D <branch-name>