by henshao · 2y ago · 0 comments
https://stackoverflow.com/questions/7726949/remove-tracking-...
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -dThe script in OP handles that edge case by switching to the main branch before deleting. That may or may not be intuitive but I think it's a reasonable response. The script also prints error messages for various other bad inputs. Once you strip all that out it's only a few lines long.