I'm always looking for quick scripts that will make life easier...
Open git bash and navigate to your git repository that you want to clean up
git fetch
git branch
git switch main
git branch --merged main | grep -v "^\* main" | xargs -n 1 -r git branch -d
git branch
git pull --rebase origin master
$ git checkout validator
$ git merge origin/main
$ git push
Open git bash and navigate to your git repository that you want to clean up
git fetch
git branch
git switch main
git branch -vv | grep ': gone]' | grep -v '\*' | awk '{ print $1; }' | xargs -r git branch -d
git branch | grep -v "main" | xargs git branch -D