In case you are using a typical Git workflow, where merged branches are removed from the remote repository (e.g., GitHub, GitLab), you may find yourself with a lot of stale local branches that have no upstreams.
A common suggestion to clean up these local branches is to run:
git fetch --prune
git branch --merged | egrep -v 'master|dev|main|staging' | xargs git branch -d
This command works only if you use a merge (not rebase) strategy and it only deletes branches that have been merged into your current branch (for example, you are in main now).