Skip to content

Instantly share code, notes, and snippets.

@mszkb
Created July 21, 2020 11:00
Show Gist options
  • Select an option

  • Save mszkb/f1582e3eae3a8a1ae6fd6e2122825d0d to your computer and use it in GitHub Desktop.

Select an option

Save mszkb/f1582e3eae3a8a1ae6fd6e2122825d0d to your computer and use it in GitHub Desktop.
gitclean: Remove all branches but the master branch + checkout master + pull + safety stash
git stash && git checkout master && git pull && git branch | grep -v "master" | xargs git branch -D
@mszkb
Copy link
Author

mszkb commented Jul 21, 2020

Use a shell alias, for example 'gitclean' in bash, zsh or similar.

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