Tsallaka zuwa abun ciki
Justice Tech School

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 ../wt

Result

2
a.txt

Exercise

Add a worktree.

git worktree  ../wt

Quiz Test

Why use worktrees?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.