How to Delete a Branch in GitHub

Of course, you can delete a remote branch using Git. But if you are relying on GitHub, you can also delete a branch directly from GitHub web interface in very simple steps.

Here's how to that.

Deleting a branch on GitHub

Go to your Repository and click on the branch button at the top, as highlighted in the image below 👇

Branch Selector Button in a GitHub Repo

Click on the View all branches button at the bottom of the popup.

View all branches link inside branch selector button in a GitHub Repo
⚠️
Please be sure about deleting the branch as it doesn't ask for any confirmation and deletes the branch right away.

Find the branch you want to delete, and click on the bin Icon on the far right.

Delete branch button in all branches list page

Once you click on it, the branch will be deleted and a restore button will appear. Reload the website and the branch will be gone.

How to restore a Deleted Branch?

🚧
It's only possible immediately after its deletion. If you reload the page or close it, the branch is deleted forever.

To restore, you need to click on the Restore button that immediately appears once you delete the branch, as shown in the image below 👇

Restore Branch Button

Conclusion

I know that purists prefer using git commands for this purpose. But I think to use Git, you don't have to go through the command line. Integrate Git into workflow. Add it to your code editor and do the commits and push the changes from there. And if you host your code on GitHub, utilize the web interface for easily managing the repositrories.

Thanks for reading, I hope you got some help from this article, keep learning, keep GitHubing & take care 😄