Commit Immutability Concept
Concept Check Medium
Question
What happens when you 'amend' a commit?
Hint
Commits are immutable — amend creates a new one.
Explanation
Commits in Git are immutable. git commit --amend does not modify the original commit — it creates a brand new commit with a new hash that includes the staged changes plus the original commit's changes. The branch pointer moves to the new commit. The old commit becomes unreachable (garbage collected eventually).
Related Resources
Related Lessons
Related Cheatsheets
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.