Git · Branches and integration

git worktree

Checks out another branch in a separate directory, so you can work without stashing.

Syntax
git worktree add <path> <branch>

Example

Example
git worktree add ../hotfix main

More in this group

git branch git checkout git cherry-pick git merge git merge --abort git switch Merge conflict markers

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course