Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save madmatvey/381a08f86e42caf75d88f377da7c519c to your computer and use it in GitHub Desktop.
Save madmatvey/381a08f86e42caf75d88f377da7c519c to your computer and use it in GitHub Desktop.
Prune local tracking branches that do not exist on remote anymore
git fetch --prune
git remote prune origin --dry-run
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