Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. Git basics
  6. Managing Git history
  7. Amending the last commit
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

Amending the last commit

Amending a commit in Git allows you to modify the most recent commit. This can include changing the commit message, adding new changes, or removing changes from the commit.

When to use amending:

  • Fixing typos or errors in commit messages: If you notice a mistake in the commit message right after committing, you can amend the commit to correct the message without creating a new commit.
  • Adding forgotten changes: If you forgot to include some changes in the last commit, you can stage the new changes and amend the previous commit to include them.
  • Removing unintended changes: If the last commit included unintended changes, you can amend to remove them.
Diagram using the git amend command.

Use git commit --amend to modify the most recent commit.

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life