Delete a remote branch in Git
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
* [new branch] production -> ref/heads/production
Notice the ref
vs refs
in the path.
Obviously I do not want this new branch on my remote server, so I want to remove it. You can remove this newly created incorrect branch with.
The Fix:
$ git push origin :ref/heads/production