VCS

Git: Delete merged branches

When using Git extensively, you’ll likely have multiple branches which need to be cleaned up from time to time. In some repositories I have hundreds of feature/, hotfix/ and release/ branches, which are already merged to the master branch and deleting them manually would be a mess.

So here’s how to delete all branches from the server, that are already merged to the master branch. In this case, branches need to start with either feature/, hotfix/ or release/ but you can simply adjust this to match your needs.