A very similar question has already been asked here: Remove local branches no longer on remote
But answers given refer to branches merged into master. I want to remove all branches on my machine that do not have a reference on remote.
Example: I carry out some work on a feature branch feat-improvements
, that gets pushed to remote, reviewed, merged to master, and deleted by the reviewer on remote. But I forgot to get rid of the branch locally by using the standard git branch -D feat-improvements
, subsequently I've created a whole load of other other fix/feature branches I want to get rid of. now I want to get rid of now in one hit.