Last active
May 27, 2022 17:21
-
-
Save yvoyer/2af5ecb82bf54e1d1eb17273f434d555 to your computer and use it in GitHub Desktop.
Cheat sheet
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
# Delete local branches that are not on remove | |
# Source: https://stackoverflow.com/questions/13064613/how-to-prune-local-tracking-branches-that-do-not-exist-on-remote-anymore/16906759#16906759 | |
git fetch -p ; git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment