After a few months a repository collects local branches, and I forget which ones still have a remote and which ones lost it. git branch -vv puts that in one list.
git branch -vv
Each line shows the branch name, the commit it points at and that commit’s subject. A single -v already adds the relationship to the upstream branch. With the second v the manual says git also prints the name of the upstream branch and, for a branch checked out in a linked worktree, the path of that worktree.
A line looks roughly like this:
* main a1b2c3d [origin/main] Fix typo in readme
old-idea 9f8e7d6 [origin/old-idea: gone] Try something
scratch 4c5d6e7 Notes
In practice gone next to an upstream means the branch was deleted on the remote, often after a merged pull request, and a line without brackets is a branch that was never pushed. That makes it a good first look before cleaning up. Run git fetch --prune first so the information is current, because git only knows what it last fetched.
Caveat: the output is for reading, not for scripts. For a script, git for-each-ref gives a stable format. And do not delete a branch just because it says gone, since local commits that were never pushed still live only there.
Further reading: git branch, -v (Git documentation)