Git remote branch deleted, but still it appears in ‘branch -a’

git remote prune origin will remove all such stale branches. That’s probably what you’d want in most cases, but if you want to just remove that particular remote-tracking branch, you should do:

git branch -d -r origin/coolbranch

(The -r is easy to forget…)

-r in this case will “List or delete (if used with -d) the remote-tracking branches.” according to the Git documentation found here: https://git-scm.com/docs/git-branch

Leave a Comment