Contributors to this thread:

nearly just shot my foot off with git. i popped a stash full of work onto a branch and then accidentally reset hard against my main branch by picking the wrong command in my shell history. poof! thankfully, with enough effort you can do anything in git—including checking out the commit representing that deleted stash...

but, some things you should somehow never allow in your shell history:
  * rm -rf <anything>
  * git reset --hard <anything>
  * probably others...


@toddsundsted A space at the start of commands you don't want in your shell history can be handy, it prevents them from being saved/included in your history.

(works with Bash and ZSH at least I think).

@nshephard thanks! i had no idea...!

@toddsundsted Bash supports/uses ReadLine as do many other libraries, really useful for command line navigation/editing which are also useful...