This is best used when you want to revert a commit that you've alredy pushed to a remote
git revert [-flags] [<commitid>]
This will revert the changes that a previous commit on the history made while keeping the changes that the commits after the one you want to revert made
This will introduce a new commit without the changes that the reverted commit made
git revert <commitid>
git push
If you want to revert the changes you did on a commit and you haven't yet pushed them, then you may be better off with reset