Git FAQ

Frequently asked questions around Git and Version Control.

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

About Us

As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.

Just like with Tower, our mission with this platform is to help people become better professionals.

That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.