Search code examples
gitgit-remote

git - After removing a remote, its branches are still reported


I ran git remote remove origin;, and after that, git log --all --decorate; shows several branches from origin, such as origin/master, origin/devel, etc.

These are not local branches.

I've used git remote prune origin and git remote update --prune, but nothing changes. The first command prunes local tracking branches, so I don't expect it to help. The second command says "prune all the remotes that are updated.", and origin wasn't actually updated; perhaps this is why it's not pruning that repo?

How do I make git forget about this repository completely?


Solution

  • I'm not sure how to do this with the git client, but perhaps what you're wanting is

    cd .git;
    rm -rf origin;
    cd refs/remotes;
    rm -rf origin;
    

    This will get rid of all those branch names in git log --all --decorate; but I'm not sure if it's safe.