Reputation: 5481
I want to remove locally all branches that I can see with git branch -r
. I've already removed all files from .git/refs/remote/*/ and appropriate records from .git/info/refs, but they are still there.
Upvotes: 4
Views: 530
Reputation: 5481
This command did the job:
git branch -r | xargs git branch -r -D
From the manual:
Use -r together with -d to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist in the remote repository or if git fetch was configured not to fetch them again. See also the prune subcommand of git-remote(1) for a way to clean up all obsolete remote-tracking branches.
Thanks to @MrTux
Upvotes: 2