I'm joining this comments a little bit later but I built this line of code that helped me go "forward" on any git tree
and I hope you can find it useful as well.
Note that I am not a bash magician so if you find something that could be changed, comment and we can make this line of code a better one!
To go backward:
git log --all --decorate --oneline | grep -A 1 $(git rev-parse --short HEAD) | awk '{print $1}' | tail -1 | xargs -I {} git checkout {}
To go forward:
git log --all --decorate --oneline | grep -B 1 $(git rev-parse --short HEAD) | awk '{print $1}' | head -1 | xargs -I {} git checkout {}
Here is some explanation:
git reflog # Here we get all the commits we need
grep -A 1 $(git rev-parse --short HEAD) # Here we grep for the short commit hash
awk '{print $1}' # Here we get just the hash
tail -1 # We will get at least 2 results, pick the last line, the first would be 0
xargs -I {} git checkout {} # Here we go "forward by 1"
Hope this can be helpful to anyone that would like to get this same behaviour. I'm building a CLI which has a command that moves you "back and forth" in the commits tree without prior knowledge of hashes or logs.