Skip to content

Instantly share code, notes, and snippets.

@nstickney
Created October 3, 2018 01:55
Show Gist options
  • Save nstickney/38f8825a4d27652573dfcf71651c8859 to your computer and use it in GitHub Desktop.
Save nstickney/38f8825a4d27652573dfcf71651c8859 to your computer and use it in GitHub Desktop.
bashrc git tableflip
# 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
@nstickney
Copy link
Author

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"

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