Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I delete a remote branch that is named orgin/branchname

Naively, I thought that git push origin origin/branchname, which was suggested by tab completion, would do the same as git push origin branchname. However, it created a new remote branch named "origin/branchname". I want to delete this branch while keeping the remote branch named "branchname" on orign.

I tried git push -d origin origin/branchname and git push -d origin remotes/origin/branchname. But both do not exist. Note that I can not use git push -d origin branchname since this would delete the remote branch named branchname and not the remote branch named "origin/branchname".

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use the delete parameter after origin.

This will delete the branch named origin/branchname but leave branchname intact.

git push origin --delete origin/branchname
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading