Steps to return temporarily to a previous commit ( to check out a stale version of our code) and then come back to the latest commit.
Start with
git stash
to stash any uncommitted changes ( stashing saves your "not-ready-for-commit" changes in a stack : you don't lose them and afterward you can come back to them )
git log
to get the hash ( the long alphanumeric identifier) of the commit you are interested in
Once you have the hash, run
git checkout <commit-hash>
A "time machine" will bring your code back to the commit you selected.
.......
Check whatever you need in your code
.......
To come back to the "present", that is your latest commit, run
git checkout master // it could also be a different branch
Lastly, to restore the "stashed" changes run
git stash pop