Skip to content

Instantly share code, notes, and snippets.

@qa1
Forked from aya986/delete git local branch
Created March 9, 2020 05:37
Show Gist options
  • Save qa1/41a464588760bb0867cf528157bdf5a4 to your computer and use it in GitHub Desktop.
Save qa1/41a464588760bb0867cf528157bdf5a4 to your computer and use it in GitHub Desktop.
// delete all origin branch that deleted from origin and stay in your local
git fetch -p
// chekout to main brach to prevent delete it from local
git checkout master
// delete all local branch
git branch | xargs git branch -d
// delete all origin branch that don't deleted from origin and stay in your local
git branch | xargs git branch -D
// now you have master branch in local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment