Git: Delete all branches except for the master/main branch – CLI Alias
It can be as simple as this alias in your terminal In my case, I had multiple branches and when I ran the gbr command, it showed the following result, deleting all three branches I had.