Git Cheatsheet
torben haack [t128n]
May 18, 2026
Switching Branches
For existing branches:
git switch <branch-name>
To create new branches:
git switch -c <new-branch-name>
Read more about git switch vs. git checkout.
Manual reference: git switch.
Working with Worktrees
List all attached worktrees:
git worktree list
Create a new worktree for a branch (creates the branch if needed):
git worktree add -b <new-branch-name> ../<folder-name>
Create a worktree for an existing branch:
git worktree add ../<folder-name> <branch-name>
Remove a worktree when done:
git worktree remove ../<folder-name>
Clean up stale worktree metadata:
git worktree prune
Manual reference: git worktree.
Discussion in the ATmosphere