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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With