To remove unused local Git branches we can utilize git-removed-branches npm package.
First install it:
npm install -g git-removed-branches
Then if you want to detect stale branches run:
git removed-branches
To remove them run:
git removed-branches –prune
The command will remove local branches which have been deleted on remote repository.