Check out example codes for "git checkout reset hard". It will help you in understanding the concepts better.

Code Example 1

git fetch origin
git reset --hard origin/master

Code Example 2

git checkout reset HEAD~1

Learn ReactJs, React Native from akashmittal.com