Local Git cleanup of remotely deleted and merged branches
It's good to clean up every once and a while.
Make sure you're on the master branch.
git checkout master
Make sure you're up-to-date.
git pull
Update remote list of branches and remove remotely deleted branches.
git fetch --prune
Delete all merged branches from your local except master. Adjust as needed if have specific branches needed for your workflow!
git branch --merged | egrep -v "(^\*|master)" | xargs git branch -d
Clear your git stash; if you set it aside months ago, you probably don't need it there.
git stash clear
Written by Jon Peck
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#