Skip to content

Instantly share code, notes, and snippets.

@ijasxyz
Last active November 14, 2018 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ijasxyz/05b20b7bc40db6f83f4141134591a64a to your computer and use it in GitHub Desktop.
Save ijasxyz/05b20b7bc40db6f83f4141134591a64a to your computer and use it in GitHub Desktop.
# famous alias 'nah' with confirmation
# created after loosing uncommitted work using 'nah' in a wrong work
# this will show the changed files in the directory before cleaning them.
function nah(){
echo
git status
echo
echo -e "\e[1m\e[91mDo you wish to reset the repo?\e[39m"
echo
select yn in "Yes" "No"
case $yn in
"Yes")
echo
git clean -qdf
git reset --hard
echo
echo -e "\e[1m\e[32mDone !\e[39m"
echo
break
;;
"No")
echo
echo -e "\e[1m\e[93mAborted !\e[39m"
echo
break
;;
*) echo -e "\e[1m\e[91mInvalid option $REPLY\e[39m";;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment