---
title: "Check out several branches at once with git worktree · Ihab Khattab"
description: "git worktree checks out another branch into a separate folder, backed by the same repository. No more stashing half-done work just to review a PR or fix…"
url: "https://ihabkhattab.com/til/git-worktree/"
---

# Check out several branches at once with git worktree

Oct 30, 2021 · [Also on X](https://x.com/HO_BA/status/1454511806781722632)

`git worktree` checks out another branch into a separate folder, backed by the same repository. No more stashing half-done work just to review a PR or fix something on `main`.

```sh
git worktree add ../hotfix main
cd ../hotfix
# fix, commit, push
git worktree remove ../hotfix
```

I’m in good company: even Guido van Rossum asked why he hadn’t known about it sooner. [Docs](https://git-scm.com/docs/git-worktree) · [Video](https://youtu.be/2uEqYw-N8uE)

[← All TILs](https://ihabkhattab.com/til/)
