Last active
July 1, 2020 09:38
-
-
Save JvanderHeide/40b804232b70f22b7561492ac345238e to your computer and use it in GitHub Desktop.
Completely reset a git repository. I found this useful when testing external scripts etc. on a repo that modify and create files. Only use this if you're really sure you want to get rid of all your local changes.
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
# Added this prompt for safety's sake in case you wanted to add this to your profile | |
while true; do | |
read -p "Are your sure you want to completely reset your repository, including untracked files? (y/N) " yn | |
yn=${yn:-N} | |
case "$yn" in | |
[Yy]* ) break;; | |
[Nn]* ) exit;; | |
esac | |
done | |
# Or just copy this line but only use this if you're really sure you want to get rid of all your local changes. | |
git reset --hard && git clean -fd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment