---
title: Git and worktrees
description: Commit, sync and review, and give each agent its own branch.
---

## Git at a glance

Each project in the sidebar shows its current branch and how many lines have changed. The **Commit** button in the header opens the git actions: commit, sync with main, review a pull request with an agent, and more. Long-running actions show their progress in a small notice until they finish.

## Worktrees: one branch per agent

When two agents work on the same project at once, they can get in each other's way. A **worktree** gives an agent its own copy of the project on its own branch, without touching your main folder.

1. **Add a worktree**

    Click **Add Worktree** on the project's header in the sidebar.

2. **Start an agent in it**

    The worktree shows up as its own project. Start an agent there like anywhere else.

3. **Merge it back**

    When the work is done, merge the worktree back and delete it from the sidebar.

Automations can also run in a fresh worktree each time, so scheduled jobs never touch your work. See [Automations](/views/automations).

:::tip[Ask Ghostex]
Try "How do I merge a worktree back into main?"
:::
