In some cases, it might be useful to have a one-liner in order to delete local unused branches.
For those who are curious, here is how you can delete unused local branches in one single line.
$ git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
Before executing this, let’s have a quick explanation about this command :
git branch –merged
: first, you are simply listing all the branches currently merged with your current checked out branch;