Accidentally pushed temporary branch to origin, want to discard it

git, github

Solution

The following command will solve your issue

` git push origin :temp `

This command has to be understood as "replace the remote branch `temp`with nothing"

alternatively, you can also perform the following one, which is a shortcut to the one above.

` git push --delete origin temp `

For more information, you can refer to the documentation.

Problem

I had created a local throw-away branch `temp`, and accidentally called ``` git push --all origin ``` which added it to my github repo. I then deleted the `temp` branch locally and did another ``` git push --all origin ``` but the branch still exists in github, though no longer associated with the master branch. How can I tell my remote repo to git rid of `temp` branch?

Original source