glossary

what is a git worktree?

TL;DR

A git worktree is a second working copy of your repository, on its own branch and in its own folder, sharing the same history. It lets you work on two branches at once without stashing or switching. For AI agents it's what makes running several in parallel safe, because each one edits its own files. Pane creates a worktree for every pane, fills it with your .env and settings, and removes it when you archive the pane.

or
Download*
Windows SmartScreen warningDirect downloads can show a SmartScreen warning while Pane is unsigned. Pane is fully open source, so you can audit the code and build from source yourself.1. Click More info2. Click Run anyway3. Continue the installerThe PowerShell install downloads the official release directly and avoids most browser download friction.npm global install
Paste that in PowerShell.Linux

A git worktree is a second working copy of your repository, in its own folder and on its own branch. It shares the same git history as your main checkout, so it's quick to create and takes little extra disk space. You can have as many open at once as you like.

the problem worktrees solve

One folder can only have one branch checked out. A worktree adds another folder with another branch.

Normally a repo is one folder with one branch checked out. To work on two things at once you stash your changes, switch branches, do the other work, switch back and unstash. It works, but it's slow and easy to get wrong.

A worktree gives you a second folder that's already on a different branch. Feature A lives in one folder and feature B in another, both open at the same time, with no stashing or switching.

why this matters for ai agents

Worktrees are what make running several agents on one repo safe.

Two AI agents in the same folder overwrite each other. Agent A edits auth.ts, agent B edits auth.ts a minute later, and whichever saves last wins. The other agent's work is gone, and neither of them knows.

With a worktree each, every agent has its own folder, branch and files. Both can edit auth.ts at the same time without touching each other's copy. When they finish, you review and merge each branch on its own.

what it looks like on disk

Same history, separate files. Where the folders live is up to you or your tool.

my-project/                 ← your main checkout (main)
my-project/worktrees/
  ├─ add-auth/              ← worktree, branch add-auth
  └─ fix-nav/               ← worktree, branch fix-nav

Every worktree shares the same git history, so a commit made in one is visible from the others. Uncommitted edits stay in their own folder. Git itself doesn't mind where worktrees live: next to the repo, in a separate folder, or inside it as Pane does.

how pane automates this

Pane creates, fills and cleans up a worktree for every pane, so you never type the commands.

You don't need to run any git commands. When you create a pane, Pane:

  1. Takes a worktree it prepared in advance for that project and branch, so the pane opens almost at once, and gives it a new branch.
  2. Copies your .env files, agent settings like .claude and .codex, and node_modules into it, so the agent can start straight away. You can change the list in Settings.
  3. When you archive the pane, checks for uncommitted, untracked or unpushed work, then removes the worktree. You can restore an archived pane later.

the manual way

Three commands to create and start, and two to clean up.

Without a tool, the same thing takes a few git commands:

echo "worktrees/" >> .git/info/exclude   # once: keep them out of git status
git worktree add worktrees/add-auth -b add-auth
cd worktrees/add-auth
claude                      # start your agent here

# once the branch is merged:
git worktree remove worktrees/add-auth
git branch -d add-auth

Remember to remove the worktree and delete the branch once it's merged. Most people forget, which is why tools automate it.

Sources

Corrections
If anything here is wrong or out of date, tell us and we'll fix it and update the date at the top. Open an issue on GitHub
Sources

frequently asked questions

or
Download*
Windows SmartScreen warningDirect downloads can show a SmartScreen warning while Pane is unsigned. Pane is fully open source, so you can audit the code and build from source yourself.1. Click More info2. Click Run anyway3. Continue the installerThe PowerShell install downloads the official release directly and avoids most browser download friction.npm global install
Paste that in PowerShell.Linux

By Parsa Khazaeepoul, co-founder of Pane. .