Skip to content

Instantly share code, notes, and snippets.

@bigeasy
Created June 27, 2012 17:44
Show Gist options
  • Save bigeasy/3005629 to your computer and use it in GitHub Desktop.
Save bigeasy/3005629 to your computer and use it in GitHub Desktop.
hidegrep
# Add to your `.bash_profile`. If you do something that is incredibly
# destructive, like `git push --force origin HEAD`, you can then
# delete it, how ever many times you've run it, from your history
# using `hidegrep --force`.
function hidegrep()
{
while true; do
hist=$(history | grep -e "$1" | head -n 1)
if [ -z "$hist" ]; then break; fi
echo $hist
history -d $(echo $hist | awk '{ print $1 }')
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment