As addition to the accepted answer:
To see the hashes you need to use the suggested command "git checkout hash", you can use git log
. Hoewever, depending on what you need, there is an easier way than copy/pasting hashes.
You can use git log --oneline
to read many commit messages in a more compressed format.
Lets say you see this a one-line list of the commits with minimal information and only partly visible hashes:
hash111 (HEAD -> master, origin/master, origin/HEAD)
hash222 last commit
hash333 I want this one
hash444 did something
....
If you want last commit
, you can use git checkout master^
. The ^
gives you the commit before the master. So hash222
.
If you want the n-th last commit, you can use git checkout master~n
. For example, using git checkout master~2
would give you the commit hash333
.