Last Updated: February 25, 2016
·
3.469K
· abh1nv

Delete local and remote Git branches

Delete a local branch:

git branch -D mybranch

Delete a remote branch (essentially pushes 'null' to the remote branch):

git push remotename :mybranch

Delete local and remote together (thanks to zzet's comment):

git push remotename --delete :mybranch

2 Responses
Add your response

git push remotename --delete :mybranch

over 1 year ago ·

git push origin :mybranch actually mean push local branch "" (empty branch) to branch "mybranch" on origin. You can also push other local branches. Example: git push heroku develop:master, that pushes local develop branch to master on heroku.

over 1 year ago ·