PandaOSPandaOS
Projects and workspace

Worktrees

Work on two branches of one project at once, each in its own folder, with nothing to stash.

Feature Updated 20 Nov 2026

What a worktree is

A worktree is a second copy of your repository on another branch, in its own folder. You use one when a long change and a quick fix should not take turns on the same folder.

Ask Panda to work on something in a worktree. It creates the worktree, adds it to PandaOS as a linked project, and switches you to it.

A fresh worktree is usually missing what git ignores, such as .env files, so it does not run. PandaOS copies the ignored files the project needs from the main folder, and can run your setup command afterwards. It only copies files git already ignores, and it asks before the first copy. If the list of files changes later, it asks again.

The Git panel's Worktrees tab: every branch checked out beside the main one, each in its own folder.
The Git panel's Worktrees tab: every branch checked out beside the main one, each in its own folder.

Start a chat in one

The quickest way in is the branch pill on top of the composer on a new chat. It shows the branch the chat will use and lists every branch, grouped by where it is checked out. New worktree… creates one on the spot. A second branch is then a choice you make when you start the conversation rather than a detour before it.

The pill only shows on an empty chat. Once the chat has a message, the branch icon in the sidebar and the header is what tells you where it is running.

What setup remembers

The first time PandaOS sets a worktree up, a card in the chat lists what it would do. That is copy the gitignored files, share installed packages with the main checkout, and run the setup command. Your answer is remembered for the project, so later worktrees are set up the same way without asking.

To be asked again, open the project's settings, switch to Permissions, and press Ask again on the Worktree setup row. The row only appears once an answer has been remembered.

See and remove them

The project overview has a Worktrees section listing every checkout with its branch and its count of uncommitted changes. The one you are in is marked You are here. Click another to switch to it, or hover it and press Remove worktree. The main folder and the checkout you are standing in cannot be removed from there.

Preview a pull request

A pull request can be run before you approve it. Open it and press Preview locally. PandaOS checks the change out into a new worktree and runs it there, so your own folder is never touched. The arrow beside the button offers In this folder instead, or Open the folder, don't run it.