Surely, many people have heard (but it is worth reminding) about thefuck utility – a great tool for fixing errors in the previous command (in the terminal).

https://github.com/nvbn/thefuck (Python, MIT)

My favorite example:

git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

$ fuck --yeah
git push --set-upstream origin branch_name
Total 0 (delta 0), reused 0 (delta 0)

Quite an extensive list of what commands thefuck can fix: https://github.com/nvbn/thefuck#how-it-works