# Branches

Open a repository's **Branches** tab to browse its branches, start a pull
request or create and delete branches. You need read access to the repository.

## Browse branches

Each row shows the branch name, its latest commit and who committed it when.
The default branch is marked `default`, and a branch that is the source of an
open pull request links to it.

- **All branches** lists every branch; **Your branches** keeps the branches
  whose latest commit you authored (on the current page).
- Type in the search box to filter by name. Pages hold up to 100 branches.

The ref switcher on the **Code** and **Commits** pages also links here through
**View all branches**.

## Create a branch

You need write access.

1. Choose **New branch**.
2. Enter the branch name and a source: a branch, a full `refs/tags/` name or a
   full commit hash.
3. Choose **Load source** to resolve its exact commit, then **Create branch**.

An existing branch is never overwritten. Most branches are created by pushing
from your own checkout; see [Git access](https://staging.git.cafe/docs/getting-started/git-access.md).

**Branch activity** (the history icon) lists your recent branch creations and
deletions. If a request's result is unknown, choose **Inspect** there instead
of submitting it again.

## Delete or restore a branch

With write access, delete a branch from its row and confirm, or run
`cafe branch delete <name> --yes`. The default branch and branches used by
open pull requests cannot be deleted, and [rulesets](https://staging.git.cafe/docs/repositories/repository-rulesets.md)
can protect others.

Deleted branches can be restored from the repository's
[settings](https://staging.git.cafe/docs/repositories/repository-settings.md#restore-a-deleted-branch) or with
`cafe branch restore <name>`.

## Start a pull request

Choose **New pull request** on a non-default branch to
[open a pull request](https://staging.git.cafe/docs/pull-requests/open.md) from it.
