checkout git próximo compromisso

git checkout $(git rev-list --topo-order HEAD..towards | tail -1)

# where towards is a SHA1 of the commit or a tag.

Example: git checkout $(git rev-list --topo-order HEAD..main | tail -1)

# Will move 1 commit towards the last commit of the main branch
KostasX