Skip to content

Instantly share code, notes, and snippets.

@yvoyer
Last active May 27, 2022 17:21
Show Gist options
  • Save yvoyer/2af5ecb82bf54e1d1eb17273f434d555 to your computer and use it in GitHub Desktop.
Save yvoyer/2af5ecb82bf54e1d1eb17273f434d555 to your computer and use it in GitHub Desktop.
Cheat sheet
# 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