git amend to previous commit code example Example 1: git amend git commit --amend Example 2: git command change to previous comit git reflog git checkout HEAD@{...}