how to revert to a particular commit git code example
Example 1: git revert commit
git reset --hard 56e05fced
git reset --soft HEAD@{1}
git commit -m "Reverting to the state of the project at f414f31"
Example 2: git revert only part of commit
Use the --no-commit (-n) option to git revert, then unstage the changes, then use git add --patch:
$ git revert -n $bad_commit
$ git reset HEAD .
$ git add --patch .
$ git commit
Note: The files you add using git add --patch are the files you want to revert, not the files you want to keep.