Automatically delete PR branches after merge on xwiki-commons, xwiki-rendering and xwiki-platform

Hi devs,

Right now, when a committer merges a pull request whose branch lives in the main repository (i.e. not a fork), the branch stays there until someone deletes it by hand. Many people forget (me included), so old branches keep piling up in xwiki-commons, xwiki-rendering and xwiki-platform.

I only just noticed that GitHub has a per-repository option for this: Settings > General > Pull Requests > “Automatically delete head branches”. I propose to turn it on for these three repositories.

What it does:

  • When a PR is merged, GitHub deletes its head branch. It only does this for branches in the same repository. Branches in contributors’ forks are never touched.
  • It doesn’t apply to protected branches (master, stable-*), and those are never PR head branches anyway.
  • If another open PR is based on the deleted branch, GitHub retargets it to the merged PR’s base branch.
  • A deleted branch can be brought back with the “Restore branch” button on the PR.

If nobody objects, I’ll enable it on the three repositories in a few days.

WDYT?

Thanks,
Thomas


This proposal was drafted with Claude Code (Claude Opus 5.5).

+1 thanks

+1 thx (you beat me, I also wanted to propose this when I recently noticed it)

+1

Thanks,
Marius

+1, thank you!

5 +1, I have now applied it on xwiki-commons, xwiki-rendering and xwiki-platform.