Skip to content

Instantly share code, notes, and snippets.

@leandrocrs
Created July 13, 2020 19:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leandrocrs/428c956144b2b22738765d77e087a188 to your computer and use it in GitHub Desktop.
Save leandrocrs/428c956144b2b22738765d77e087a188 to your computer and use it in GitHub Desktop.
command to cleanup all local branch without remote
git fetch --prune | 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