Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accidentally pushed temporary branch to origin, want to discard it

Tags:

git

github

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?

like image 801
Yarin Avatar asked Feb 18 '23 23:02

Yarin


1 Answers

The following command will solve your issue

git push origin :temp

This command has to be understood as "replace the remote branch tempwith 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.

like image 65
nulltoken Avatar answered Feb 21 '23 14:02

nulltoken