Git UndoLesson 36Free preview
Git Amend
This lesson is part of Git · All levels
Summary
Git commit -- amend the last commit, both the message and the content, by replacing the commit with a new version. Amendments change the hash commit so that it's risky if the old commit is already pushed and used by teammates. For longer commits, use interactive rebases.
Key points
- -amend to replace the last commit with a new version.
- Includes forgotten files: git add and commit --amend --no-edit
- Do not amend commits that have been published to the shared branch
- Old commits can be changed by git rebase.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.