How to Delete a Branch in Git

Delete a Branch

Delete a Git Branch

Deleting a branch in Git involves following steps:
  • Delete the remote branch (usually <remote> is origin):
git push <remote> --delete <branch>
  • Delete the local branch:
git branch --delete <branch>

Considerations

  • If you want to delete the currently checked out branch, you have to switch to another branch before.
  • Deleting a local tracking branch that is identical to its remote branch is generally safe because the remote commits are still referenced on the server.
  • Otherwise, be sure to not delete an important (remote) branch.

With SmartGit

Right-click the branch to delete
Right-click the branch (in the Branches or Graph view) and select Delete.
Select what branch(es) to delete
If you want to delete the remote branch, too, select the checkbox. Finally, click the Delete button.

Try these Git operations with SmartGit's intuitive interface

Download SmartGit
Illustration of Smart Gitty, the SmartGit mascot -- a grey cartoon cat with glasses, sitting behind a laptop