Skip to content

Instantly share code, notes, and snippets.

@ibnuh
Created March 26, 2020 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibnuh/512fcb9e3dd37cae4b76f8eeda2d8cbe to your computer and use it in GitHub Desktop.
Save ibnuh/512fcb9e3dd37cae4b76f8eeda2d8cbe to your computer and use it in GitHub Desktop.
Git remove local branch that aren't on remote
git fetch -p && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -D
@ibnuh
Copy link
Author

ibnuh commented Mar 26, 2020

@ibnuh
Copy link
Author

ibnuh commented Mar 26, 2020

Remove merged branches

git branch --merged | grep -v "\*" | grep -v "master" | grep -v "develop" | grep -v "staging" | xargs -n 1 git branch -d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment