Worktrees: Several Branches at Once
git worktree add checks out another branch into a new folder that shares the same repository. No need to stash to hotfix.
Example
echo one > a.txt && git add a.txt && git commit -qm 'first'
git worktree add -q -b hotfix ../wt
git worktree list | wc -l
ls ../wt
git worktree remove ../wtResult
2 a.txt
Exercise
Add a worktree.
git worktree ../wt
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.