Recall & Review
beginner
What does the command
git restore --staged <file> do?It removes the specified file from the staging area, effectively 'unstaging' it, so changes won't be included in the next commit.
Click to reveal answer
beginner
How do you unstage all files that were added to the staging area?
Use
git restore --staged . to unstage all files at once.Click to reveal answer
intermediate
What is the difference between
git restore --staged and git reset?git restore --staged unstages files without changing the working directory, while git reset can unstage and also move the HEAD pointer.Click to reveal answer
beginner
True or False:
git restore --staged deletes your changes in the file.False. It only removes the file from the staging area but keeps your changes in the working directory.
Click to reveal answer
beginner
Why might you want to use
git restore --staged before committing?To remove files accidentally added to the staging area, so you only commit the intended changes.
Click to reveal answer
What does
git restore --staged file.txt do?✗ Incorrect
This command unstages the file, so it won't be included in the next commit.
Which command unstages all files at once?
✗ Incorrect
git restore --staged . unstages all files currently staged.
Does
git restore --staged delete your changes in the file?✗ Incorrect
The command only removes the file from staging but keeps your changes in the working directory.
What is a common reason to use
git restore --staged?✗ Incorrect
It helps you remove files from staging if you added them by mistake.
Which command is a newer alternative to unstage files instead of
git reset HEAD <file>?✗ Incorrect
git restore --staged is the modern way to unstage files.
Explain how
git restore --staged helps manage your commits.Think about what happens when you add files by mistake.
You got /4 concepts.
Describe the difference between
git restore --staged and git reset when unstaging files.Consider what each command affects: staging area, working directory, and commit history.
You got /4 concepts.