4.0 KiB
4.0 KiB
Git commit form
The commit form is the block at the top of the Git view, under its top bar. It holds the commit message, the author, and the Commit split button.
Guide index · Related: Git, Notifications, Keyboard shortcuts
At a glance
+----------------------------------------------------------------------------+
| (1) fix the login form_ |
|----------------------------------------------------------------------------|
| (2) Jonathan <jonathan@example.com> (3) Cmd+Enter commits |
| (4) [ Commit 2 files | v ] |
+----------------------------------------------------------------------------+
(5)
+------------------------+
| v Commit |
| ^ Commit and push |
+------------------------+
- Message field: the commit message. The grey placeholder
Commit messageshows while it is empty. - Author:
user.name <user.email>from your git config, read when the view opens. With no email set, only the name shows; with no name, nothing. - Hint:
⌘↵ commits. - Commit button:
Commit N files, orNothing staged. The caret on its right opens the menu. - Commit menu: Commit and Commit and push.
Features
Write the message
- Opening the Git view puts the cursor in the field.
Cmd+Cwith no text selected, outside a terminal, opens the view there too. - The field gets an amber line under it while it has the cursor.
- The field grows with long text and scrolls after about seven lines.
- A commit message in Helder is always one lowercase line:
- Capitals become lowercase as you type or paste.
- A line break becomes a space.
Enterdoes not start a new line, and it does not commit.
- This keeps dictated or pasted text as one short subject line.
- The draft stays in the field while the view is closed.
Commit
You can commit in three ways:
- Click Commit N files.
- Choose Commit from the caret menu.
- Press
Cmd+Enterwhile the view is open. This works from the message field too, but not from the console input.
The button is amber when at least one file is staged and the message is not empty. Otherwise it is grey. A click always runs git commit, also when the button is grey, so git's own refusal shows in the console.
Commit and push
- Choose Commit and push from the caret menu. It commits, and when the commit succeeds it pushes, the same as the Push button. See Pull and push.
After a commit
- The message field clears.
- The committed files leave the staged section. Unstaged edits stay where they were.
- A notification says
Committed N files, with the start of your message below it (cut off after 34 characters). - Push in the top bar shows
↑N, because the branch is now ahead of its remote.
When a commit fails
- Your message stays in the field, so you can fix and retry.
- A notification says
Commit failed, with git's first error line below it. The full output is in the console. Typical causes are nothing staged, an empty message, or a git hook that rejected the commit. - When the message was empty, the cursor goes back to the field.
Keyboard
| Keys | Action |
|---|---|
Cmd+C |
Open the Git view on the message field (no text selected, not in a terminal) |
Cmd+Enter |
Commit, while the Git view is open (not from the console input) |
Cmd+P |
Push the current branch |
Related
- Git: the view that holds this form, and where you stage files.
- Notifications: the messages after a commit or push.
- Keyboard shortcuts: every shortcut in one list.