Check out example codes for "make previous commit master". It will help you in understanding the concepts better.

Code Example 1

git checkout master
git reset --hard <old_commit_id>

Learn ReactJs, React Native from akashmittal.com