Git Tip: How to Delete a Remote Branch

This is one of the many git functions I always have to look up, and it always makes me insane at its non-intuitiveness. However, as it is a necessary evil, I thought it useful to capture it here.

Believe it or not, you have to use git push to delete. You heard that right. Stop gawking. Jaw closed.

OK so here’s how you do it:

git push origin :[name of branch]

As a concrete, though perhaps not entirely realistic example:

git push origin :my-awesome-feature

Thanks to the following blogs for their constant assistance in helping me remember (or not remember) this function:

git ready : push and delete remote branches
Yuji Tomita : Git — Delete Remote Branch

Thanks guys!

Posted in Git