git restore notes.txt # throw away unstaged changes git restore --staged notes.txt # unstage, keep the changes git revert HEAD # undo the last commit with a new one git reset --soft HEAD~1 # un-commit, keep the work staged (local commits only!) git reflog # your safety net