Created
March 26, 2020 02:48
-
-
Save ibnuh/512fcb9e3dd37cae4b76f8eeda2d8cbe to your computer and use it in GitHub Desktop.
Git remove local branch that aren't on remote
This file contains hidden or 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
git fetch -p && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D |
Remove merged branches
git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/a/59912825/4460712