I’ll introduce a command to bulk delete merged remote branches in Git.
git branch --remote --merged master | \\
grep -v -e master -e release -e staging | \\
sed -e 's% *origin/%%' | \\
xargs -I% git push --delete origin %
This assumes that master, release, and staging branches are excluded from deletion.
Even if someone else deletes remote branches, the remote branch information remains in your local branches.
You can synchronize remote branch information with the following command:
git remote prune origin
Alternatively, you can synchronize by adding the —prune option like:
git fetch --prune
or
git pull --prune
That’s all from the Gemba.