git: Remove remote branch
This is something I want to blog in order to save it for posterity so I don’t go crazy looking for this. I have a remote branch I committed but I need to remove it for whatever reason, how do I do this with git?
You do this in two easy steps:
The key here is that you push a non-existent branch, so it basically removes it from the remote repository. That’s it!
You do this in two easy steps:
- Remove the local branch either through your favorite GUI or via: git branch -d “branch name”
- Push the removed branch to the remote origin: git push origin :refs/heads/”branch name”
The key here is that you push a non-existent branch, so it basically removes it from the remote repository. That’s it!