cli command commit staged changes code example Example 1: git discard staged changes git reset HEAD git checkout . Example 2: git check staged changes git diff --cached