If you are working on a branch and want to abandon it, what do you do?
It’s easy to remove it from your local repository:
$ git branch -d mybranch # delete branch "mybranch"
And then how do you remove it from a GitHub repository? This works:
$ git push firstname.lastname@example.org:<my_account>/<my_repository>.git :heads/<mybranch>
But there’s an easier way. Scott Chacon suggests:
You can also do (assuming ‘origin’ is the name of your remote):
git push origin :mybranch
Scott Chacon is the author of the Git Internals book from Peepcode.