git revert <hash code>helps to roll back to a previous commit by creating a new commit for it. Doesn’t removes those commits from the log like git reset does.
git reflogthis can be useful to bring back deleted commits/files/changes. Use git reset <hash code of lost commit from reflog> to bring back rolled changes.
git reset HEAD~2Helps roll back by 2 commits and unstage all the changes in those 2 removed commits.
git reset HEAD~2 --hard
git rebase (most useful command)- Reapply commits on top of another base tip. ex. git rebase master sets the branch at the tip of master branch