Recall & Review
beginner
What does the command
git commit --amend do?It lets you change the last commit by adding new changes or editing the commit message without creating a new commit.
Click to reveal answer
beginner
How can you change only the commit message of the last commit without changing files?
Run
git commit --amend without staging new changes. This opens the editor to edit the message.Click to reveal answer
intermediate
True or False: Amending a commit changes the commit's unique ID (hash).
True. Amending creates a new commit with a new ID because the commit content changes.
Click to reveal answer
intermediate
Why should you be careful when amending commits that have already been pushed to a shared repository?
Because it rewrites history and can cause problems for others who pulled the original commit.
Click to reveal answer
beginner
What is the difference between
git commit --amend and creating a new commit?Amending changes the last commit itself, while a new commit adds a separate change on top of the history.
Click to reveal answer
What happens if you run
git commit --amend after staging new changes?✗ Incorrect
Amending replaces the last commit with a new one that includes the staged changes.
Which command lets you edit the last commit message without changing files?
✗ Incorrect
The
--amend option opens the editor to change the last commit message.Why is it risky to amend commits that have been pushed to a shared repository?
✗ Incorrect
Amending rewrites history, which can cause conflicts for collaborators.
What is the effect on the commit ID when you amend a commit?
✗ Incorrect
Amending creates a new commit with a new unique ID.
If you want to add forgotten changes to your last commit, what should you do?
✗ Incorrect
Staging changes and amending updates the last commit with those changes.
Explain how to safely amend the last commit message without changing any files.
Think about the steps to change only the message.
You got /4 concepts.
Describe the risks of amending commits that have already been pushed to a shared repository and how to avoid problems.
Consider teamwork and shared history.
You got /5 concepts.