**Answering very shortly about revert and reset **
There are many way you can do this. Based on your requirement choose anything from below.
1. By REVERTing commit:
If you want to REVERT all the changes from you last COMMIT that means If you ADD something in your file that will be REMOVED after revert has been done. If you REMOVE something in your file the revert process will ADD those file.
You can REVERT the very last COMMIT. Like:
1.git revert HEAD^
2.git push origin <Branch-Name>
Or you can revert to any previous commit using the hash of that commit.Like:
1. git revert <HASH>
2.git push origin <Branch-Name>
Or if the commit is a merge commit you can try this:
1.git revert -m 1 <HASH> (-m 1 refers to the first parent of two merged branches)
2.git push origin <Branch-Name>
2. By RESETing previous Head
If you want to just point to any previous commit use reset; it points your local environment back to a previous commit. You can reset your head to previous commit or reset your head to previous any commit.
Reset to very last commit.
1.git reset HEAD^
2.git push -f origin <Branch-name>
Reset to any previous commit:
1.git reset <HASH>
2.git push -f origin <Branch-name>
Trade of between REVERT & RESET:
Why would you choose to do a revert over a reset operation? If you have already pushed your chain of commits to the remote repository (where others may have pulled your code and started working with it), a revert is a nicer way to cancel out changes for them. This is because the Git workflow works well for picking up additional commits at the end of a branch, but it can be challenging if a set of commits is no longer seen in the chain when someone resets the branch pointer back.
And resetting a branch can be destroying what you have done till now.Because when you reset a commit, GIT will delete all the commits that have done after this commit.One silly mistake can destroy all your hard work and it doesn't keep any history what you are resetting. On the other hand reverting a commit is better option in this scenario. When you revert a commit, GIT creates a new commit with the completely opposite changes of the commit you are willing to revert.And it points to the end of that branch. So it won't mess up anything on our silly mistake.