# Ensure branches are deleted after pull request merge

- Source: https://support.icompaas.com/support/solutions/articles/a_1790019221591482-ensure-branches-are-deleted-after-pull-request-merge
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [Version Control System (VCS)](https://support.icompaas.com/support/solutions/c_1781179095087930) › [GitHub](https://support.icompaas.com/support/solutions/folders/f_1781179116560328)
- Last updated: 2026-09-21
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Description**

Ensure the repository is configured to automatically delete the head branch of a pull request once it has been merged into the base branch.

**Rationale**

Merged feature branches that are never cleaned up accumulate over time, making the repository harder to navigate and increasing the chance that a developer accidentally continues work on, or pushes to, a stale branch. Automatic deletion keeps the branch list current and reduces the surface of forgotten branches.

**Impact**

-   Automatically removes merged feature branches, keeping the repository clean
    
-   Reduces the risk of developers accidentally continuing work on, or pushing to, stale branches
    
-   Lowers the number of branches that must be tracked and secured
    
-   Simplifies branch protection scoping and review
    

**Default Value**

By default, GitHub does not automatically delete head branches after a pull request is merged.

**Pre-Requisites**

-   Admin access to the repository
    

**Test Plan**

1.  Sign in to GitHub at [https://github.com](https://github.com/).
    
2.  Select the relevant repository.
    
3.  Click Settings.
    
4.  On the General page, scroll to the Pull Requests section.
    
5.  Verify that Automatically delete head branches is checked.
    

6.  If it is unchecked, follow the implementation steps.
    

**Implementation Steps**

1.  Sign in to GitHub at [https://github.com](https://github.com/).
    
2.  Select the relevant repository.
    
3.  Click Settings.
    
4.  On the General page, scroll to the Pull Requests section.
    

5.  Select Automatically delete head branches.
    

6.  The change is saved automatically.
    

**Backout Plan**

1.  Sign in to GitHub at [https://github.com](https://github.com/).
    
2.  Select the relevant repository.
    
3.  Click Settings.
    
4.  On the General page, scroll to the Pull Requests section.
    
5.  Deselect Automatically delete head branches.
    

**Reference**

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

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
