I usually fetch
from a remote repo that I share with my team members. Then I merge their branches into my main
branch and create new local branch to do development. Everything is going well EXCEPT that the list that I see in git branch -va
keeps getting bigger and bigger as I fetch
more from the remote repo. and merge
(please see the screenshot below) these into my local repo.
What I see when I type git branch -va
in my repo.
I'm wondering if there's a git command that will allow me to remove these 'remotes/origin/Brazil', 'remotes/origin/Chile', etc. from appearing in the git branch -va
command.
I tried using the following approaches:
git branch -d remotes/origin/Brazil
(error: branch 'remotes/origin/Brazil' not found) (StackOverflow suggestion link)git fetch --prune
(nothing happens) (StackOverflow suggestion link)git remote prune origin
(nothing happens) (StackOverflow suggestion link)
I some of these branches to go away when using git push --all --prune
as suggested here. But some comment related to that StackOverflow answer say this command is dangerous.
What is the safest and correct way to remove these old 'remotes/origin/*' from appearing in the result of git branch -va
? Thanks in advance for your answers!