Home > front end >  How do I delete a remote branch that is named orgin/branchname
How do I delete a remote branch that is named orgin/branchname

Time:04-15

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".

CodePudding user response:

Use the delete parameter after origin.

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

git push origin --delete origin/branchname

CodePudding user response:

to remove an remote branch locally use git remote remove origin/branchname, if you want to remove from remote content you must use git push origin --delete origin/branchname as in the answer of sytech

  • Related