Git : remove all local branches already merged in master

web Git
Reading time: 1 minute, 0 seconds

During a development, a lot of branches are created on Git for all features or evolutions.

After a certain time, we can have on local machine many branches but some cleaning may be necessary.

For instance, If you want to delete all local branches that are already merged into master, you can use the following command:

git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d

Next Post Previous Post