You can the past commits by typing:
git log
If you want to see the past commits, you can use the ancestor symbol ^
or the tilde ~
. For example, let’s say that I want to see the parent commit of the HEAD. We can type:
git show HEAD^
Or
git show HEAD~1
Now, if we want to see the “grand-parent”, i.e. two steps back. We can type:
git show HEAD^^
Or
git show HEAD~2
Similarly, if we want to add more steps back, we add more ancestors, for example the three steps back will be HEAD^^^ or HEAD~3 if we use the tilde notation.
Finally, note that instead of the “HEAD” you can enter the corresponding SHA (or at least the first 7 characters of it).