Posted by spencerldixon 19 hours ago
git branch --merged origin/main --format="%(refname:short)" \ | grep -vE "^(main|develop)$" \ | xargs -r git branch -d
that said... pretty hilarious a dev was just like "uhh yeah ciaclean..." curious what... other aliases they might have??so then it's `git ciaclean` and not bare `ciaclean` which imo is cleaner.
git branch --format '%(if:equals=gone)%(upstream:track,nobracket)%(then)%(refname:short)%(end)' --omit-empty | xargs --verbose -r git branch -D
It deletes all the branches for which remotes were deleted. GitHub deletes branches after PR was merged. I alias it to delete-mergedgit branch -vv | grep ': gone\]' | awk '{print $1}' | xargs -n 1 git branch -D