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

Quiz: How Git Works Inside · Question 8 of 10

Why does git commit --amend always produce a new commit id?

Why does git commit --amend always produce a new commit id?

  1. A.Git adds a random number to amended commits
  2. B.Amend deletes the repository history
  3. C.Commit ids are assigned by GitHub
  4. D.The commit's content (message, tree or time) changes, so its hash changes
Answer & explanation

Correct answer: The commit's content (message, tree or time) changes, so its hash changes

An id is the hash of the content, so any change produces a different id.

Can you get the rest right without peeking?

Take the timed Quiz: How Git Works Inside quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →