Created
October 4, 2023 18:44
-
-
Save organom/f2e137752fb83e28c8ea1e3659bfbfc5 to your computer and use it in GitHub Desktop.
Cleanup all git local branches that are not in remote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!#/bin/bash | |
function git-branch-cleanup() { | |
git remote prune origin | |
git branch -vv | grep ': gone]'| grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -d | |
} | |
git-branch-cleanup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment