As long as the commit you are 'undoing' is local and is not part of any remote branch (you have not push-ed it yet), or if this is a one-dev pet project and you are sure nobody is 'consuming' your remote branch (and you can push to it with --force) - git reset is OK.
The thing is - it rewrites history. So if you'll make another commit on top of it but the 'undone' commit is pushed already, the history of your local branch and your remote tracking branch will diverge - and you'd have to push it either to another branch, or with --force, rewriting the remote branch. And if the remote branch is rewritten, anyone who had cloned it won't be able to pull from it any more that easily etc...
Thus the general advise is not to rewrite history of remote branches, and that's what git revert is for.
Funny side note - once seen a commit starting with a word Revert repeated 6 times o_O
I'm a Software Engineer, from Portugal, a GitHub Star and a mentor at Black CodHer Bootcamp and "As Raparigas de Codigo" organization. Previously, I've been an admin at AnitaB.org Open Source.
As long as the commit you are 'undoing' is local and is not part of any remote branch (you have not push-ed it yet), or if this is a one-dev pet project and you are sure nobody is 'consuming' your remote branch (and you can push to it with --force) - git reset is OK.
The thing is - it rewrites history. So if you'll make another commit on top of it but the 'undone' commit is pushed already, the history of your local branch and your remote tracking branch will diverge - and you'd have to push it either to another branch, or with --force, rewriting the remote branch. And if the remote branch is rewritten, anyone who had cloned it won't be able to pull from it any more that easily etc...
Thus the general advise is not to rewrite history of remote branches, and that's what git revert is for.
Funny side note - once seen a commit starting with a word Revert repeated 6 times o_O
Great explanation! In my case, I thought revert was better because I pushed the previous changes before.