# Managing branches within your repository

Create new branches for development and delete unused branches directly on GitHub.

## Creating a branch

Create a branch for a separate place to work on changes before opening a pull request.

> \[!NOTE]
> You can only create a branch in a repository to which you have write access.

### Creating a branch via the branches overview

1. Navigieren Sie auf GitHub zur Hauptseite des Repositorys.
2. Wähle in der Dateistrukturansicht das Dropdownmenü <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-git-branch" aria-label="git-branch" role="img"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> für Branches aus, und klicke anschließend auf **View all branches**. Du findest das Branchdropdownmenü auch oben im integrierten Datei-Editor.

   ![Screenshot der Dateistrukturansicht für ein Repository, Ein Dropdownmenü für Branches ist aufgeklappt und dunkelorange umrandet.](/assets/images/help/repository/file-tree-view-branch-dropdown-expanded.png)
3. Click **New branch**.

   ![Screenshot of the "Branches" page for a repository. A green button, labeled "New branch", is highlighted with an orange outline.](/assets/images/help/branches/new-branch-button.png)
4. Under "Branch name", type a name for the branch.
5. Under "Branch source", choose the repository and branch to base your new branch on.
6. Click **Create branch**.

### Creating a branch using the branch dropdown

1. Navigieren Sie auf GitHub zur Hauptseite des Repositorys.

2. Select the <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-git-branch" aria-label="git-branch" role="img"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> branch dropdown menu, in the file tree view or at the top of the integrated file editor.

   ![Screenshot of the file tree view for a repository. A dropdown menu for branches is outlined in dark orange.](/assets/images/help/branches/file-tree-view-branch-dropdown.png)

3. Optionally, to create the new branch from a branch other than the default branch of the repository, click another branch. Then, select the branch dropdown menu again.

4. In the "Find or create a branch..." text field, type a unique name for your new branch, then click **Create branch**.

   ![Screenshot of the branch selector dropdown menu. "Create branch: new-branch" is highlighted with an orange outline.](/assets/images/help/branches/create-branch-text.png)

### Creating a branch for an issue

You can create a branch to work on an issue directly from the issue page. See [Erstellen eines Branches zum Arbeiten an einem Problem](/de/issues/tracking-your-work-with-issues/using-issues/creating-a-branch-for-an-issue).

## Deleting a branch

Delete branches that you no longer need, such as branches for merged or closed work.

Du kannst festlegen, dass Head-Branches automatisch gelöscht werden, nachdem die Pull Requests in Deinem Repository zusammengeführt wurden. Siehe [Automatische Löschung von Branches verwalten](/de/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches).

> \[!NOTE]
> If the branch you want to delete is the repository's default branch, choose a new default branch first. See [Ändern des Standardbranchs](/de/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/changing-the-default-branch).

If the branch is associated with an open pull request, merge or close the pull request before deleting the branch.

1. Navigieren Sie auf GitHub zur Hauptseite des Repositorys.
2. Wähle in der Dateistrukturansicht das Dropdownmenü <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-git-branch" aria-label="git-branch" role="img"><path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"></path></svg> für Branches aus, und klicke anschließend auf **View all branches**. Du findest das Branchdropdownmenü auch oben im integrierten Datei-Editor.

   ![Screenshot der Dateistrukturansicht für ein Repository, Ein Dropdownmenü für Branches ist aufgeklappt und dunkelorange umrandet.](/assets/images/help/repository/file-tree-view-branch-dropdown-expanded.png)
3. Next to the branch that you want to delete, click <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-trash" aria-label="The trash icon" role="img"><path d="M11 1.75V3h2.25a.75.75 0 0 1 0 1.5H2.75a.75.75 0 0 1 0-1.5H5V1.75C5 .784 5.784 0 6.75 0h2.5C10.216 0 11 .784 11 1.75ZM4.496 6.675l.66 6.6a.25.25 0 0 0 .249.225h5.19a.25.25 0 0 0 .249-.225l.66-6.6a.75.75 0 0 1 1.492.149l-.66 6.6A1.748 1.748 0 0 1 10.595 15h-5.19a1.75 1.75 0 0 1-1.741-1.575l-.66-6.6a.75.75 0 1 1 1.492-.15ZM6.5 1.75V3h3V1.75a.25.25 0 0 0-.25-.25h-2.5a.25.25 0 0 0-.25.25Z"></path></svg> .

   ![Screenshot of a branch in the branch list. A trash icon is highlighted with an orange outline.](/assets/images/help/branches/branches-delete.png)
4. If the branch is associated with at least one open pull request, deleting the branch closes the pull requests. Read the warning, then click **Delete**.

Wenn du einen Haupt-Branch löschst, nachdem sein Pull Request zusammengeführt wurde, wird GitHub auf offene Pull Requests für das gleiche Repository prüfen, die den gelöschten Branch als ihren Basis-Branch angeben. GitHub aktualisiert solche Pull Requests automatisch, indem es deren Basis-Branch auf den Basis-Branch des zusammengeführten Pull Requests ändert.
See [Branches](/de/pull-requests/reference/branches).

## Further reading

* [Branches](/de/pull-requests/reference/branches)
* [Branches in Deinem Repository anzeigen](/de/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/viewing-branches-in-your-repository)
* [Branches in einem Pull Request löschen und wiederherstellen](/de/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/deleting-and-restoring-branches-in-a-pull-request)