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
Top comments (0)