Delete git branch not in remote
Goffity Corleone
Posted on April 15, 2022
I'm not sure where I received the information, but it was most likely from stackoverflow.
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
Update 2022-08-02
git checkout develop && git branch --merged | grep -v 'main' | grep -v 'develop' >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches
Ref: https://stackoverflow.com/questions/7726949/remove-tracking-branches-no-longer-on-remote
💖 💪 🙅 🚩
Goffity Corleone
Posted on April 15, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.