﻿---
title: Worktrees
description: The Repos view, every worktree of every repo, and how they come and go.
url: https://docs-v3-preview.elastic.dev/worktrees
---

# Worktrees
`gr` opens Repos: every repo Heed knows, every worktree added to them, and the cleanup rules.
![Repos: the repo column, the worktree table, and the cleanup rules](https://docs-v3-preview.elastic.dev/images/shots/worktrees/repos.png)
The table shows each worktree's repo, branch, the agent of the session working there, its status (upstream, ahead,
behind, uncommitted changes) and its pull request.

| Key                |                                                                                                                       |
|--------------------|-----------------------------------------------------------------------------------------------------------------------|
| `↩`                | Open the worktree's session, or [import](https://docs-v3-preview.elastic.dev/worktrees/importing) it when it has none |
| `o`                | Start work in the repo under the cursor                                                                               |
| `dd`               | [Remove](https://docs-v3-preview.elastic.dev/worktrees/removing) the worktree (asks first)                            |
| `v`                | Select rows, then `d` remove, `y` copy paths, `o` open or import                                                      |
| `w`                | Flip the repo between all issues and only yours ([Issues](https://docs-v3-preview.elastic.dev/github/issues))         |
| `r`                | Refresh: rescan for repos                                                                                             |
| `:repo.add <path>` | Add a repo outside the scanned folders; it is kept in `repo_paths`                                                    |
| `:cleanup.rules`   | Show the cleanup rules panel (it hides on narrow windows and with `zi`)                                               |
| `{` `}`            | Previous / next repo                                                                                                  |
| `/`                | [Filter](https://docs-v3-preview.elastic.dev/sessions/filtering) by repo, branch or agent                             |

- [Repos](https://docs-v3-preview.elastic.dev/worktrees/repos): where repos come from, and their order and colours.
- [Importing](https://docs-v3-preview.elastic.dev/worktrees/importing): worktrees made outside Heed, and any path.
- [Removing](https://docs-v3-preview.elastic.dev/worktrees/removing): what is removed, and what never is.
- [Cleanup](https://docs-v3-preview.elastic.dev/worktrees/cleanup): removing idle worktrees automatically.