Discarding and Unstaging with git restore
Made a mess in a file? git restore <file> throws away your unsaved changes and brings back the last staged or committed version. This cannot be undone, because those edits were never saved in Git.
You can also unstage a file. If you ran git add too early, git restore --staged <file> takes it out of the staging area but keeps your edits.
Quick check
Which command removes a file from the staging area but keeps your edits?
Your turn: write the code
note.txt is committed with the text Hello, then overwritten. Bring the committed text back and print the file.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.