Git Cheat Sheet · Worktrees
Switch between worktrees
cd <folder>
Each worktree is a separate folder: cd <folder> is all it takes to go there. Nothing is rewritten on disk, unlike a branch switch: a long build can keep running in one worktree while you code in another.
What it does
Each worktree is a separate folder: going there is enough, nothing is rewritten on disk, unlike a branch switch.
A use case
You run a long build in one worktree and keep coding in another in the meantime.
On the command line
git worktree list- Finds each worktree's folder.
cd ../site-hotfix- Goes to another worktree.
git rev-parse --show-toplevel- Shows the root of the worktree you are in.
In Merathon
- Click the worktree in the "Worktrees" section: it opens in a tab, or its tab is shown if already open.
- Right-click → "Open in a new window" to see them side by side.
Frequently asked questions
Is a commit made in one worktree visible in the others?
Yes, right away: they share the same repository, without push or fetch. Only their current branch and their files stay specific to each one.
Is a stash shared between worktrees?
Yes: git stash list shows the same list everywhere, and a stash created in one worktree can be resumed in another.