Git Commit Amend
Question
What does git commit --amend do?
Hint
amend rewrites the last commit.
Explanation
git commit --amend modifies the most recent commit instead of creating a new one. It combines staged changes with the previous commit and lets you edit the message. This is useful for fixing a mistake in the last commit. However, never amend commits that have been pushed, as it rewrites history and causes issues for collaborators. Use --no-edit to keep the original message.
Related Resources
Related Lessons
- Git Commit
Learn git commit.
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.