undo last commit but keep chhanges code example Example 1: git reset keep changes git reset HEAD^ --soft Example 2: undo last commit but keep changes git reset @~