Skip to content

Instantly share code, notes, and snippets.

@jaysephjw
Last active September 21, 2020 21:23
Show Gist options
  • Save jaysephjw/4c58c939c96868033861798c9d57804e to your computer and use it in GitHub Desktop.
Save jaysephjw/4c58c939c96868033861798c9d57804e to your computer and use it in GitHub Desktop.
git - prune and delete locals
# prune remote branches from "origin". Remove --dry-run when confident.
git remote prune origin --dry-run;
# delete branches with a gone upstream. Remove last pipe to run dry.
git branch -vv | grep " \[origin" | grep gone | awk '{print $1}' | xargs -L 1 git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment