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.
1 Answer
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
.git/packed-refs?git branch -r -D NAME. Why do you want to delete them manually? - if those are deleted remotely you xan usegit fetch REMOTE --prunegit branch -D, how do I remove the reference to a remote branch with this command, for examplerefs/remotes/origin/develop?