git get latest commit code example Example 1: git get current commit git rev-parse HEAD Example 2: how do i get the last commit $ git reset --soft HEAD~1