How to Delete a Branch on GitHub
The GitHub.com browser interface allows you to delete (and create) remote branches. To do this, you need to navigate to the main page of the repository in your browser and then click the "# branches" link. On the branches overview page, you can then choose a branch to delete:
However, it's very important to understand that you can only delete remote branches, not any of the branches in your local Git repository!
In order to delete a local branch, you need to use Git on your local computer, either via the Command Line or through a desktop GUI.
Deleting a Branch in Git
Using Git on your local computer allows you to delete both local and remote branches. Let's start with deleting a local branch. On the command line, you can type the following:
$ git branch -d <local-branch>
To delete a remote branch, you need to use the "git push" command:
$ git push origin --delete <remote-branch-name>
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
In case you are using the Tower Git client, you can delete both local and remote branches simply from the contextual menu. Also, if you decide deleting a branch was a mistake, you can undo this with a simple "CMD+Z" keyboard shortcut:
Learn More
- Check out our detailed FAQ article on How to Delete a Local Branch
- More frequently asked questions about Git & version control