Your destination for complete Tech news

How to delete all local branches except master in Git

1.51K 0
< 1 min read

Sometimes we may not notice that the local branches are increasing and manually deleting branches one by one can take much time.

You can use the below code snippet in terminal to Delete all the local branches but keep the master

$ git branch | grep -v "master" | xargs git branch -D

Leave A Reply

Your email address will not be published.

5 + 2 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.