Amend the most recent commit message or contents with git commit --amend
domain: git-scm.com · 6 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗
Documented steps
Stage any files you want to fold into the last commit with `git add <paths>`, then run `git commit --amend` to add those changes to the most recent commit and open the editor to edit its message.
To change only the message without touching contents, run `git commit --amend -m "new message"` or `git commit --amend --no-edit` to keep the existing message while folding staged changes.
Amend without staging anything new by running `git commit --amend --no-edit` (no paths needed; the last commit is rewritten in place).
Reset the author to your configured identity after an amended/cherry-picked commit with `--reset-author` (`git commit --amend --reset-author --no-edit`).
Verify the new commit with `git log -1` and `git show HEAD`.
Official docs: https://git-scm.com/docs/git-commit
Known gotchas
`--amend` replaces the last commit with a NEW commit object, changing its SHA — never amend a commit that is already pushed/shared unless you intend to force-push (and coordinate with collaborators).
If nothing is staged, `git commit --amend` still rewrites the commit (possibly just the message); use `--no-edit` to avoid accidentally opening the editor.
`--amend` only ever touches the most recent commit; for older history use interactive rebase (`reword`/`edit`) instead.
The original commit is preserved in the reflog, so a mistaken amend can be recovered but not by `git reset` alone.
Give your agent this knowledge — and 17,000+ more routes
One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp
Need this verified for your stack — or a route we don't have yet?