How to delete GitHub branches automatically after merge by default

I saw a lot of big projects/repositories with hundreds or even thousands of stale branches where nothing really happens. Usually, no one cares to clean up all this mess. There is a nice simple GitHub tweak where you can prevent this.

Automatically delete merged branches

Github branches can be automatically deleted after press on the merge button.

You need to be a repository admin:


  1. Navigate to repository "Settings"
  2. Scroll down to the "Merge button" section
  3. Activate "Automatically delete head branches" checkbox


If you're merged something accidentally and want your branch back? Don't worry, you'll be able to restore deleted branches.