🎙 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 7 of 10

You committed but forgot to add one file and have not pushed. What is the simplest fix?

You committed but forgot to add one file and have not pushed. What is the simplest fix?

  1. A.git revert HEAD
  2. B.git add the file, then git commit --amend
  3. C.Delete the repository
  4. D.git reset --hard HEAD~5
Answer & explanation

Correct answer: git add the file, then git commit --amend

amend replaces the last commit with one that includes the file.

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 →