Below is a small example with Mercurial and similarly to Git. I can't figure out how to do hg update using Git:
I have a small Mercurial installation with 4 commits - where I back off one commit
hg init echo "1" > a.txt; hg commit -A -m "1. commit" a.txt echo "2" >> a.txt; hg commit -m "2. commit" a.txt echo "3" >> a.txt; hg commit -m "3. commit" a.txt echo "4" >> a.txt; hg commit -m "4. commit" a.txt hg update -r 3 thg
It gives this image.

Note that I see all four commits - that is, both the backstory and the next commit (s)
Let me try to do the same example using Git
git init echo "1" > a.txt; git add a.txt; git commit -m "1. commit" a.txt echo "2" >> a.txt; git commit -m "2. commit" a.txt echo "3" >> a.txt; git commit -m "3. commit" a.txt echo "4" >> a.txt; git commit -m "4. commit" a.txt
Let me see the commits:
git log --graph --pretty=format:'%h -%d %s (%cr) <%an>' * 57bb375 - (HEAD, master) 4. commit (14 minutes ago) <Peter Toft> * 724a493 - 3. commit (14 minutes ago) <Peter Toft> * bb38732 - 2. commit (14 minutes ago) <Peter Toft> * 879c593 - 1. commit (15 minutes ago) <Peter Toft>
Good - four fix as expected. Let me get back to one commit (similar to updating hg).
git checkout 724a493
What about git log?
git log --graph --pretty=format:'%h -%d %s (%cr) <%an>' * 724a493 - (HEAD) 3. commit (19 minutes ago) <Peter Toft> * bb38732 - 2. commit (19 minutes ago) <Peter Toft> * 879c593 - 1. commit (19 minutes ago) <Peter Toft>
Will gitk also show the first 3 commits?
So, "git checkout" NOT is like "hg update". Where are the following commits?
source share