Clean the local git repository from merged local branches and remotely deleted branches
Checkout to the main branch. The branch against which we want to check the merged branches.
git checkout <main_branch>
Get all the merged branches and safe delete (-d) them.
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
Remove all the local branches which are remotely deleted.
git remote prune origin
Or
git fetch -p
Written by Raphaël De Giusti
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#