Say if I checked out a previous version of a repo. Let's assume each commit is represented by a number for simplicity, illustrated below. How can I check out the version after the one HEAD is pointing at? I know I can get to the previous commit by
git checkout HEAD~1
but how can I get to the latter commit, in this case, commit number 4, without knowing its SHA-1 value?
1 2 3 4 5
HEAD