Last active
May 24, 2021 19:03
-
-
Save rjchicago/c33b74413703b071ebe5ae9e57275bf8 to your computer and use it in GitHub Desktop.
Sometimes you just want to reset everything and clean up with only the master branch again (locally). This script will reset hard, checkout master, and delete all local non-master branches.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git reset --hard && git checkout master && git branch | grep -v "^..master$" | xargs git branch -D && git pull | |
# add to ~/.bash_profile | |
# alias git-reset-master='git reset --hard && git checkout master && git branch | grep -v "^..master$" | xargs git branch -D && git pull' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment