---
title: Delete Head Branch (Deprecated)
description: Delete pull request head branch. Deprecated in favor of GitHub's built-in "Automatically delete head branches" setting.
---

import ActionOptionsTable from '../../../../components/Tables/ActionOptionsTable';

:::danger
  The `delete_head_branch` action is **deprecated** and will be removed on
  June 30, 2026. Use GitHub's built-in
  [automatically delete head branches][gh-auto-delete] setting instead.
:::

The `delete_head_branch` action allows Mergify to automatically delete the head
branch of a pull request once it has been merged. This can be useful for
maintaining a clean repository and reducing clutter from unused branches.

## Parameters

<ActionOptionsTable def="DeleteHeadBranchActionModel" />

## Examples

Here is an example of how the `delete_head_branch` action can be used in your
workflow:

```yaml
pull_request_rules:
  - name: delete head branch after merge if the label "cleanup" is present
    conditions:
      - merged
      - label = cleanup
    actions:
      delete_head_branch:
```

In this example, Mergify will automatically delete the head branch of a pull
request once it has been merged, but only if the pull request has been labeled
with "cleanup".

The `delete_head_branch` action is a simple yet powerful tool that can help
maintain the cleanliness and organization of your repository.

[gh-auto-delete]: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-the-automatic-deletion-of-branches
