Day 4 of 10 30 minrestoreamendrevertreset
Everyone makes mistakes; Git lets you fix almost all of them. Discard edits, unstage files, fix the last commit, and safely undo commits with revert or reset.
By the end of today you can
- Choose the right undo command for each situation
- Discard working-directory changes with git restore
- Unstage files with git restore --staged
- Fix the last commit with git commit --amend
- Undo commits safely with git revert, and know when git reset is appropriate
What's inside
- 7 sections
- 3 diagrams and mind maps
- 5-question quiz
- 1Discard edits you haven't staged
- 2Unstage a file
- 3Fix the last commit: --amend
- 4Undo a shared commit: git revert
- 5Rewind local commits: git reset
- 6The safety net: git reflog
- 7Which one do I need?
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free