Doz
Doz

Reputation: 7149

Git remote branch re-appears after deleting

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'

Upvotes: 0

Views: 106

Answers (1)

John Szakmeister
John Szakmeister

Reputation: 47102

To delete the branch from the remote repository, you need to do: git push origin :branch-name. That's Git speak for remove branch-name from the remote repository.

Presumably, you have a reference to the remote branch locally (called origin/branch-name) and a local branch called branch-name. git remote prune origin will remove all origin/ references to branches that no longer exist, which will leave you with just the local branch. You can delete that with git branch -d branch-name, if you like.

Upvotes: 5

Related Questions