You can clean up local branches that do not exist on the remote by combining a few Git commands. One way to do this without scripts is:
git fetch --all
git branch -vv
Then remove those manually with:
git branch -D branch-name
Repeat that only for branches marked as [gone].
Source: https://flatcoding.com/tutorials/git/git-delete-branch-locally-and-remotely/