After merging changes or working on temporary branches, users may retain a list of orphaned git branches on their local machine. Rather than deleting each branch one-by-one, running a simple script can clear them out.
The one-liner script to delete local branches not found one remote:
This works by detected if a branch is
[gone] from remote.