Last active
September 1, 2021 15:42
-
-
Save c50/54b07dcdb2fd2376eb9a8caf79ac0672 to your computer and use it in GitHub Desktop.
Git delete locally all remote branches that are gone remotely
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
git fetch -p && for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D $branch; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This may differ when your terminal has different language settings. You can check it first typing this:
git branch -vv
e.g. in french you may then need to adapt "gone" to its French translation "disparue".