How do I git-revert from the command line?

To discard all local changes, you do not use revert. revert is for reverting commits. Instead, do:

$ git reset --hard

Of course, if you are like me, 7 microseconds after you enter that command you will remember something that you wish you hadn’t just deleted, so you might instead prefer to use:

$ git stash save 'Some changes'

which discards the changes from the working directory, but makes them retrievable.

Leave a Comment