Skip to content

Commit and amend

Write the message, amend the last commit, and sign without leaving stage.

c commits what is in the index. A folds the index into the last commit instead. Both open the same message editor.

  1. Press c. The message editor opens.
  2. Type the message. The first line is the subject.
  3. Press ctrl+s.
The title counts the staged files. ctrl+s writes the commit.

The title of the editor counts the files you are about to commit. With nothing staged, c shows nothing staged to commit and opens no editor.

  1. Stage the changes you want to add.
  2. Press A. The editor opens with the message of the last commit.
  3. Change the message, or keep it.
  4. Press ctrl+s.
The message of the last commit is already in the editor.

An amend replaces the last commit. The commit count does not grow.

CAUTION: Do not amend a commit that other people already pulled. An amend gives the commit a new hash, and their history no longer matches yours.

Press w to commit with --no-verify. The editor opens with WIP in it, and the title says that hooks are skipped.

This is the only way to skip hooks. A message that starts with WIP does not skip them by itself.

Press C to write the message in $EDITOR instead. stage gives the terminal to your editor, and takes it back when the editor exits.

Use this command when you want your commit.template, or the output of a prepare-commit-msg hook. The modal editor never shows either of them.

stage compares HEAD before and after to learn what happened, because the exit code of an editor says nothing about git. If nothing was committed, stage shows commit aborted — nothing committed.

Move to the commits panel with 4. These commands run as a rebase.

Key Action
r Change the message of the commit under the cursor
A Fold the staged changes into the commit under the cursor
a Change the author of the commit

A signed commit shows a Signed: row in the commit view. An unsigned commit shows nothing, so a repository that does not sign gets no extra noise.

Your signing agent can be locked when you commit. git then waits for a passphrase that it cannot ask for, and the commit does not finish.

stage notices this. It shows the blocked write, and gives you three answers:

Answer Result
Unlock stage gives the terminal to the passphrase prompt of the agent
Abort stage stops the write. The commit is lost
Keep waiting The prompt closes. The write continues

The prompt also closes by itself if you unlock the agent somewhere else and the commit finishes.

In the message editor, ctrl+g unlocks the signing agent. stage shows this key only when git is configured to sign.