Delete Git Branch


NOTE: Git does not allow you to delete the branch that you are currently on. You must switch to another branch.
 

Delete A Local Branch 

#my branch is the name of the branch
git branch -d mybranch

 

If you havent merged the changes from the branch you are deleting and you are sure you don't mind losing the changes. You can use the -D flag instead to for the delete.

#DELETE AN UNMERGED BRANCH
git branch -D mybranch

 

Cookbook Category: 
Git