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
Written by Abhinav Ajgaonkar
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Remote
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#