2026-spring git-github/lessons/07-undoing-things/commands.sh

9 lines420 B

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
# See the lesson README for what to try next.
# Try changing the values above and run it again.