developing smarter web applications...

Delete a remote branch in Git

I run into this all the time. I am typing too fast when I push code to my remote repository and I make a typo that creates a new branch in my remote repository.

Correct: git push origin production:refs/heads/production

Mistake: git push origin production:ref/heads/production
Result: * [new branch]    production -> ref/heads/production

Obviously I do not want this new branch on my remote server, so I want to remove it. You can remove this newly created branch with.

The Fix: git push origin :ref/heads/production