Im trying to delete a remote branch and it keeps on re-listing. I have tried
1) git branch -rd origin/legacy
2) git gc –prune=now
3) git branch -d -r origin/legacy
4) When i try git remote rm origin/legacy
I get error: Could not remove config section ‘remote.origin/legacy’
To delete the branch from the remote repository, you need to do:
git push origin :branch-name. That’s Git speak for removebranch-namefrom the remote repository.Presumably, you have a reference to the remote branch locally (called
origin/branch-name) and a local branch calledbranch-name.git remote prune originwill remove allorigin/references to branches that no longer exist, which will leave you with just the local branch. You can delete that withgit branch -d branch-name, if you like.