Editing the last commit

These commands modify the last (a.k.a., "HEAD") commit. The commit is modified (a.k.a., replaced) immediately. Similar commands exist for modifying other (non-HEAD) commits. Those commands are described in the following two sections. For each command in this section, we mention the respective non-HEAD commands, to make the relation explicit.

The command descriptions below mention the specific arguments they use when calling git commit. The arguments specified in the menu are appended to those arguments.

c e (magit-commit-extend)

This command amends the staged changes to the last commit, without editing its commit message.

This command calls git commit --amend --no-edit.

With a prefix argument the committer date is not updated; without an argument it is updated.

The option magit-commit-extend-override-date can be used to inverse the meaning of the prefix argument. Non-interactively, the optional OVERRIDE-DATE argument controls this behavior, and the option is of no relevance.

c a (magit-commit-amend)

This command amends the staged changes to the last commit, and pops up a buffer to let the user edit its commit message.

This command calls git commit --amend --edit.

c w (magit-commit-reword)

This command pops up a buffer to let the user edit the message of the latest commit. The commit tree remains unchanged and staged changes remain staged.

This command calls git commit --amend --only --edit.

With a prefix argument the committer date is not updated; without an argument it is updated.

The option magit-commit-reword-override-date can be used to inverse the meaning of the prefix argument. Non-interactively, the optional OVERRIDE-DATE argument controls this behavior, and the option is of no relevance.