π Parent Note
Delete Local Branch
π Usual way
git branch --merged
lists branch that is merged into the current branch.
so, this deletes merged branches.
git branch --merged | grep -v master | xargs git branch -d
π¦ Delete Squashed Merged Branch
Only 3 steps.
# show local branches
$ git branch
* master
branch1
branch2
branch3
# grep them
$ git log | grep 'branch1\|branch2\|branch3'
Merge branch 'branch2' into 'master'
# force delete it
$ git branch -D branch2
π Delete Remote Branch
# delete remote branches with some conditions
git branch --remote | grep -v "upstream" | egrep -v "origin/master|origin/deployment" | xargs git branch -dr
Top comments (0)