[tip] Remote git branch – How to delete?
Ok, you probably delete your local branch with this command:
$ git branch -D branchname
But how to delete this branch in your remotes?
From Pro Git by Scott Chacon, we have:
Deleting Remote Branches
Suppose you’re done with a remote branch — say, you and your collaborators are finished with a feature and have merged it into your remote’s master branch (or whatever branch your stable codeline is in). You can delete a remote branch using the rather obtuse syntax git push [remotename] :. If you want to delete your serverfix branch from the server, you run the following:
$ git push origin :serverfix To firstname.lastname@example.org:schacon/simplegit.git - [deleted] serverfix
Boom. No more branch on your server. You may want to dog-ear this page, because you’ll need that command, and you’ll likely forget the syntax. A way to remember this command is by recalling the git push [remotename] [localbranch]:[remotebranch] syntax that we went over a bit earlier. If you leave off the [localbranch] portion, then you’re basically saying, “Take nothing on my side and make it be [remotebranch].”