If you do git branch -d branchname
, it will delete branch name if it references an earlier commit in your history, or tell you that you need to use -D
otherwise. I often create branches that are later pushed to master, and can thus be deleted by this criterion. Is there an easy way to list all the branches that point to earlier commits of master, that is, branches that git will not mind deleting with just the -d
option? Bonus points if it works for all branches at once, not just master.
I've got 82 local branches and I know that quite a few if not most of them can safely be deleted by now, but I don't want to take the time to go through each one to try to do it.