Created
October 3, 2018 01:55
-
-
Save nstickney/38f8825a4d27652573dfcf71651c8859 to your computer and use it in GitHub Desktop.
bashrc git tableflip
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
# https://twitter.com/aran384/status/1046487063489437696 | |
if [ ! -x "$(command -v tableflip)" ]; then | |
tableflip() { | |
while true; do | |
read -r -p "Really throw it all away? [y/N]: " -n 1 yn | |
printf '\n' | |
case $yn in | |
[Yy]* ) git fetch && git reset --hard && git clean -dfx; break;; | |
[Nn]* ) break;; | |
"" ) break;; | |
esac | |
done | |
} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can also do this in your
.gitconfig
file:[alias] tf = "!f(){ while :; do read -r -p 'Really throw it all away? [y/N]: ' -n 1 yn; printf '\n'; case $yn in [Yy]* ) git fetch && git reset --hard && git clean -dfx; break;; [Nn]* ) break;; '' ) break;; esac done; }; f"