🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Undoing Changes: all 10 questions

Quiz: Undoing Changes · Question 4 of 10

How do you unstage a file but keep its changes?

How do you unstage a file but keep its changes?

  1. A.git restore --staged file
  2. B.git restore file
  3. C.git rm file
  4. D.git reset --hard
Answer & explanation

Correct answer: git restore --staged file

git restore file (without --staged) would discard the changes.

Can you get the rest right without peeking?

Take the timed Quiz: Undoing Changes quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →