djacobus
7/16/2018 - 5:26 PM

GitHub - Clean Local Branches vs Remote

Code to be run in the terminal to cleanup local branches not found at remote.

#List Variances
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' 

#Cleanup
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d