Commits
The commit box
21 min read
The commit box sits at the bottom of the changes panel, on the right side of the window. It shows up when the // WIP row is selected in the graph (or when no commit is selected). That's where you write the message, choose the options and record the commit.
From top to bottom, the box has:
- the Free-form | Conventional message mode selector (see Conventional Commits);
- the Commit summary field, with the character counter;
- the Description (optional) field, with the expand button in the corner;
- the Templates and Co-authors buttons and the people already chosen (see Templates and Co-authors);
- the issue reference button, when the branch has an issue (for example
Closes #123); - the Amend previous commit checkbox (see Amend);
- the collapsible Commit options block;
- the Commit surgery bar ("Commit as fixup of…", "Absorb…"), explained in Commit surgery;
- the Commit as line, with the email that goes into the commit;
- the repository rules strip, when the team or the company has rules;
- the commit button.
The usual path: stage what goes into the commit, write the summary and click the button. Versora
builds the message, checks what needs checking and runs git commit.
- Changes panel: select the // WIP row at the top of the graph; the box is at the bottom of the right panel.
- Shortcut to get to the message: Ctrl+Shift+M ("Go to the commit message").
- Shortcut to commit: Ctrl+Enter with the focus in any field of the box (the button's tooltip shows "Shortcut: Ctrl+Enter").
- Stage the files, hunks or lines that go into the commit (see Staging).
- Click Commit summary and write a short line, for example
Fix the login form validation. - If you need to explain why, write it in Description (optional). It can have several paragraphs.
- Check the commit button's text: it says what is going to happen, for example Commit 2 files.
- Click the button or press Ctrl+Enter.
- While the app checks, the bar shows "Checking before commit…"; during the commit, "Committing…".
- Done: the commit shows up in the graph, the box is empty and the one-time options (such as Skip Git hooks) are unchecked again.
The button changes with the state of the panel. When it's disabled, the text says what's missing:
| Button text | When it shows up |
|---|---|
| Resolve conflicts to commit | There are files in the "Conflicted" section |
| Stage changes to commit | Nothing staged, no amend and no merge in progress |
| Type a message to commit | The summary is empty |
| Commit 1 file / Commit 3 files | Ready to commit (the number is the number of staged files) |
| Commit | Merge in progress with no staged files (the commit concludes the merge) |
| Amend previous commit | The amend checkbox is checked |
The checked options are added at the end of the text: Commit 2 files without hooks, Commit 2 files and push or Commit 2 files without hooks and push.
| Option | What it does | Default |
|---|---|---|
| Per-repository draft | The summary and the description are kept while you switch tabs or select another commit in the graph | Always on, while the app is open |
| Prepared squash merge message | When a local squash merge stops midway (conflict or hook), the box shows "Prepared message from the squash merge of feature/login" with Use and the dismiss button | Goes in on its own if the box is empty |
commit.template | With a message template configured in git, the empty box starts with it, with the variables ({branch}, {issue}, {author}…) replaced (see Templates) | Only if git has commit.template |
The message is the summary, a blank line and the description, with no extra spaces at the ends. It goes to git through standard input, always in UTF-8:
git -c i18n.commitEncoding=UTF-8 commit -F -
# with "Skip Git hooks":
git commit -F - --no-verify
# with "Amend previous commit":
git commit -F - --amend
The commit takes only what is staged (the index). No text editor is opened. If git is configured
to sign (commit.gpgsign), signing happens in this same command (see
Commit signing).
- Ctrl+Z (outside a text field) or the undo button on the bar undoes the commit. The button shows "Undo: Commit "Fix the login form validation" (Ctrl+Z)".
- Versora moves the branch back to the previous commit with
git reset --soft: the commit's changes go back to Staged files, ready for a new commit. - The message doesn't come back to the box. Ctrl+Shift+Z (redo) recreates the commit exactly as it was.
- The commit that concludes a merge in progress undoes the entire merge: the branch goes back
to the commit before the merge, and so do the files (
git reset --hard, without the staging middle ground, which on the next commit would become a squash without the second parent). If Versora started the merge, the button shows its name (for example "Undo: Merge feature/login into main"). The steps taken while the merge was stopped, such as resolving a file in the conflict editor, leave the undo history at that point. The same goes for the commit that concludes a stopped cherry-pick or revert that Versora started: undo removes the whole operation. See Stopped merge, rebase, cherry-pick and revert. - If the commit has already been pushed (for example, with Push after committing), Ctrl+Z undoes only the local branch. The commit stays on the remote, and the branch's next push will have to be forced.
Details in Undo and redo and in the Timeline (Alt+Z).
Tip
Inside a text field, Ctrl+Z is the field's own undo (the text you typed), not Versora's undo. To undo the commit, click outside the field (on the graph, for example) and press Ctrl+Z, or use the undo button on the bar.
- "Checking before commit…": the app is running the checks. A second click on the button in the meantime is ignored.
- "Before committing", with Commit anyway: one or more checks found something (see Checks before the commit).
- "The commit was not created": git rejected the commit. The output stays in the box (see When the commit is rejected).
- "Git identity not configured":
user.nameoruser.emailis missing. Set up identity opens Preferences › Profile. Nothing is lost: what was staged stays there. - Description lines that start with
#go into the commit as they are. Versora doesn't treat them as comments (only templates have comments), unless your gitcommit.cleanupsetting says otherwise.
- Preferences › Commit › Message: recommended summary length and Push after commit.
- Preferences › Operations › Commit: automatic wrapping of the body.
- The company policy can make these pages read-only or hide them (see Company policy).
- Staging by file, hunk and line
- Amend: amending the last commit
- Stopped merge, rebase, cherry-pick and revert
- Squash: combining commits and local squash merge
The summary is the first line of the message: it's what shows up in the graph, in commit lists and in merge requests. A short summary shows in full almost everywhere.
- Commit box › Commit summary field.
- Counter: the number to the right of the field is how many characters still fit within the recommended length.
- Length: Preferences › Commit › Message › Recommended summary length.
- Write the summary. The counter goes down with each letter.
- If the counter turns red (a negative number), the summary went past the recommended length. Hover over the counter to read: "Summaries up to 72 characters show in full in most tools (adjust the limit in Preferences › Commit)".
- Shorten the summary and move the details to the description. The commit isn't blocked because of this: it's just a warning.
| Option | What it does | Default |
|---|---|---|
| Recommended summary length | Length from which the counter turns red. Accepts 20 to 200 characters | 72 |
| Maximum field length | The field doesn't accept more than 200 characters | 200 (fixed) |
The same length also works as the summary length warning when the repository requires Conventional Commits without commitlint (see Conventional Commits).
Nothing extra: the summary becomes the first line of the git commit -F - message.
- "Enter a whole number between 20 and 200.": the value typed in Recommended summary length is out of range.
- A title length limit set by the team (
.versora.yml) or by the company isn't a warning: a message that goes past it isn't committed. In that case, Preferences › Commit shows "In this repository, the commit title has at most 72 characters (team rule (.versora.yml))." See Team rules in the commit box.
- Preferences › Commit › Message › Recommended summary length.
.versora.yml:commit.title_maxandcommit.title_min; company policy:commit_title_max(see The .versora.yml file).
The description is the body of the commit. Versora wraps the line on its own at column 72 as you type, as git convention asks, without touching code, trailers and long addresses. For longer texts, the expanded editor shows a ruler at the column and the cursor position.
- Commit box › Description (optional) field.
- Expanded editor: the button in the corner of the field, "Expand the description editor".
- Preference: Preferences › Operations › Commit › Hard wrap the body.
- Palette (Ctrl+P): "Operations preferences".
- Write in Description (optional). When a line goes past the column, it's wrapped at the last space before it. The cursor stays where it is.
- For a long text, click "Expand the description editor". The Commit description window opens, with a monospaced font and a vertical ruler at the wrap column.
- At the bottom of the window you see "Line 3, column 18 · longest line: 64 of 72". The longest line is highlighted when it goes past the column.
- If you pasted a text with lines of varying lengths, click Reflow paragraphs ("Joins the lines of each paragraph and wraps them again at 72 columns").
- Click Done, press Esc or Ctrl+Enter to go back to the commit box. Inside the expanded editor, Ctrl+Enter only closes the editor; it doesn't commit.
| Option | What it does | Default |
|---|---|---|
| Wrap the commit body automatically | Wraps the line that goes past the column at the last space, as you type | On |
| Wrap column | Column for wrapping and for the expanded editor's ruler. Accepts 40 to 200 columns | 72 |
| Hard wrap at 72 columns (in the expanded editor) | The same option, turned on and off right there | The preference's value |
| Reflow paragraphs | Joins the lines of each paragraph and wraps them again at the column | Button |
What wrapping does not touch:
- code lines (that start with 4 spaces or a tab);
- trailers, such as
Signed-off-by: …andCo-authored-by: …; - words longer than the whole line, such as long addresses.
Reflow paragraphs treats blank lines as paragraph breaks and keeps list items
(- item, * item, 1. item) at the start of the line, with the continuation aligned to the
item's text.
With wrapping off, the border of the Description (optional) field changes color when a line goes past the column, so you can wrap it by hand.
Nothing extra. Wrapping only replaces spaces with line breaks in the text, before the commit. The
whole message goes in git commit -F -.
Automatic wrapping and Reflow paragraphs change the field's text. There's no button to go back to the previous text: check the result before Done. To avoid wrapping, turn off Hard wrap at 72 columns before pasting the text.
- "Use a number between 40 and 200.": the Wrap column value is out of range; the previous value stays in effect.
- Preferences › Operations › Commit › Hard wrap the body: Wrap the commit body automatically and Wrap column.
The Commit options block brings together two choices: running the commit without git hooks and pushing right after the commit. Collapsed, it shows the active options next to the title, for example "without hooks · push after commit".
- Commit box › Commit options (click the title to open or collapse it). The app remembers whether you left it open.
- Push after commit is also in Preferences › Commit › Message.
- Click Commit options.
- To not run the hooks for this commit, check Skip Git hooks. Next to it, the app shows which hooks are active in the repository, for example "— active: pre-commit, commit-msg", or "— no commit hooks active here".
- To push the commit as soon as it's created, check Push after committing.
- Check the button's text: Commit 2 files without hooks and push.
- Commit as usual.
| Option | What it does | Default |
|---|---|---|
| Skip Git hooks | git commit --no-verify: doesn't run the pre-commit and commit-msg hooks. Applies to one commit only: once a commit is created, it's unchecked again. If the commit fails, it stays checked | Unchecked |
| Push after committing | Pushes the branch right after the commit; publishes the branch if it isn't on the remote yet. It's the same option as in Preferences › Commit: checking it here leaves it checked for the next commits, in all repositories | Unchecked |
| Preferences › Commit › Push after commit › Checked by default | Leaves Push after committing checked by default | Off |
# Skip Git hooks
git commit -F - --no-verify
# Push after committing (the usual push, with the checks before pushing)
git push
# branch without upstream: the app asks for the remote and publishes the branch
git push -u origin feature/login
# amend of a commit that was already on the remote: force push, with confirmation
# (--force-if-includes is added when the git version supports it)
git push --force-with-lease --force-if-includes
The list of active hooks comes from the repository's hooks folder (honoring core.hooksPath):
the app looks for pre-commit and commit-msg.
- Skip Git hooks doesn't record anything: just uncheck it.
- The push done by Push after committing isn't undone with Ctrl+Z: the commit is already on the remote (see How to undo in "Write and record a commit").
- Skip Git hooks only skips git hooks. Versora's own checks (team rules, commitlint, secrets, protected branch…) keep running.
- With an amend of a commit that was already on the remote, Push after committing does a force push and asks for confirmation first ("Overwrite origin/feature/login with your local feature/login? Uses --force-with-lease: fails if the remote has commits you haven't fetched yet.").
- The push goes through the checks before pushing ("Before pushing"); see Push.
- Preferences › Commit › Message › Push after commit.
- Skipping hooks on push, pull, merge and rebase: see Push.
When git rejects the commit (usually a pre-commit or commit-msg hook that found a problem), Versora doesn't just show a passing notice: the whole output stays in the commit box until you dismiss it. It's what tells you what needs fixing.
- Commit box › Commit options: the block opens on its own and shows "The commit was not created", with the git and hook output right below.
- Read the output. It comes without color codes; if it's long, the box scrolls.
- To keep it or send it to someone, use the Copy output button ("Output copied" appears).
- Fix what the output points out (for example, run the formatter or adjust the message) and commit again. The message stays in the box.
- If the hook doesn't apply to this commit, check Skip Git hooks and commit again.
- To take the box off the screen, click Dismiss (the X).
The same git commit -F - as always. The output shown is what git and the hook wrote. Before
showing it, the app checks again which hooks are active (the hook may have changed).
Nothing was recorded: the commit doesn't exist and the staging area stays as it was.
- "A hook is active (pre-commit): fix what the output points out and try again, or check "Skip Git hooks"." (or "Hooks are active (pre-commit, commit-msg): …"): the commit was attempted with the hooks on, and they may be the cause.
- "Commit signing failed. Check the key and format in Preferences › Commit.": git couldn't sign. The link opens Preferences › Commit; see Commit signing.
- A missing identity (
user.name/user.email) doesn't become output in the box: the app opens the "Git identity not configured" dialog.
The shortcuts take you to the message and record the commit without taking your hands off the keyboard.
- Shortcut help: F1 or Ctrl+/.
- To change the keys: Preferences › Keyboard shortcuts (see Shortcuts and keymap).
| Default shortcut | Name in the keymap | What it does | Where it works |
|---|---|---|---|
| Ctrl+Shift+M | "Go to the commit message" | Shows the changes panel (if another commit was selected), puts the focus on the Commit summary and selects its text | Anywhere in a repository tab |
| Ctrl+Enter | "Commit (from the commit message)" | Commits, like the button | With the focus in a field of the commit box |
| Ctrl+Shift+Enter | "Stage all and commit" | Stages everything and commits | In the commit box or outside any text field |
| Alt+I | "Add the issue reference to the message" | Adds the branch's issue reference (see the next section) | With the changes panel open and no dialog open |
- Write the summary (or leave it for later: see step 3).
- Press Ctrl+Shift+Enter.
- Without a message, nothing is done, not even the staging: the focus goes to the summary and "Write the commit message first (Ctrl+Shift+M takes you there)." appears.
- With a message, the app stages everything in Unstaged files and in conflict (except the "don't commit" list) and commits, with the same checks as the button.
git add -A # the "Stage all changes"; with the "don't commit" list, only the other files
git commit -F -
Ctrl+Z undoes the commit and leaves everything staged, including what the shortcut put there. To unstage it, use Unstage all changes (Ctrl+Shift+U). With a merge in progress, the commit concludes the merge, and Ctrl+Z undoes the entire merge, as described in How to undo, at the start of this page.
- Files still have conflict markers: with conflicted files,
Ctrl+Shift+Enter does the same as the Stage all changes
button. If any of them still has markers (
<<<<<<<), the same confirmation appears ("Staging marks the conflicts as resolved with the markers inside the files. Stage everything anyway?"), with the Stage anyway button. If you give up, nothing is done, not even the commit. A conflicted file that you've already resolved on disk (without markers) is staged without a question. See Staging. - If, after staging, the button is still disabled, the app shows the button's text in a notice (for example "Type a message to commit").
- The single-key staging shortcuts (S, U) don't fire with the focus in a text field; see Staging.
- Preferences › Keyboard shortcuts: change any of these shortcuts.
When the branch name mentions an issue (feature/123-login, PROJ-123-login), the commit box
shows a button that puts the reference in the message: Closes #123 at the end of the description
(GitLab and GitHub) or PROJ-123 at the start of the summary (Jira).
- Commit box › the button with the reference text (for example Closes #123), with the "Alt+I" hint next to it.
- Shortcut: Alt+I.
- Work on a branch linked to an issue (see Issues).
- Write the message.
- Click the reference button or press Alt+I. The button's tooltip says where it will put the text: "Add "Closes #123" at the end of the description (Alt+I)" or "Add "PROJ-123" at the start of the summary (Alt+I)".
- After that, the button is disabled and shows "#123 in message" (tooltip: "The message already references #123"). The reference isn't written twice.
The format and the place are in Preferences › Issues › Reference in the commit message, per repository:
| Option | Values | Default |
|---|---|---|
| Reference format | Closes {ref}, Refs {ref} or just the key | GitLab/GitHub: Closes #123; Jira: the key |
| Where to add the reference | At the start of the summary or At the end of the description | GitLab/GitHub: at the end of the description; Jira: at the start of the summary |
Nothing extra: the text goes into the message before the commit. "Closes" closes the issue when the commit reaches the default branch (that's GitLab's and GitHub's doing).
Delete the text from the message before committing.
- With a dialog open, Alt+I doesn't touch the message underneath it.
- The button disappears when the branch doesn't mention an issue or when the issue doesn't exist.
When the repository has a .versora.yml with message rules, or the company has set rules for the
computer, the commit box shows a strip with the rules in effect and, while you write, what the
message doesn't meet yet. A message outside these rules isn't committed: there's no "commit
anyway".
- Commit box › the strip above the commit button (label for screen readers: "Rules for this repository").
- See rules, on the strip, opens Preferences › Policy and team.
- Read the strip: it sums up the rules, for example "title up to 72 · Conventional Commits · types: feat, fix, docs". When no summary is possible, "team rules in effect" appears.
- Write the message. A moment after you stop typing, the strip lists up to three problems, for example "The title has 81 characters; the maximum is 72.".
- If the rule requires
Signed-off-by, the strip says "Signed-off-by will be added (team rule (.versora.yml))." You don't need to write it. - If the team asks for the trailer for code made with AI, answer on the strip (see AI co-authorship trailer).
- Commit. If something is still outside the rules, the "The message doesn't follow the rules" dialog lists what to fix ("Fix the message and commit again:"), and the button is Fix the message.
The rules the strip shows (the configuration is in .versora.yml or in the company policy):
| On the strip | Rule | Message when not met |
|---|---|---|
| "title up to 72" | Maximum title length | "The title has 81 characters; the maximum is 72." |
| "title of 10 or more" | Minimum title length | "The title has 6 characters; the minimum is 10." |
| "Conventional Commits" | Conventional Commits required | "The title doesn't follow Conventional Commits (type(scope): description)." |
| "types: feat, fix, docs" | Allowed types | "The type chore isn't one of the allowed ones: feat, fix, docs." |
| "title pattern" | Expression the title has to match | "The title doesn't follow the pattern ^[A-Z]+-\d+ ." or the team's hint with the pattern |
| (Signed-off-by line) | Signed-off-by required | The app adds it when committing |
Messages that git writes itself (merge, revert, fixup!, squash!, amend!) go through without
being checked.
The check is done by the app. Signed-off-by and the AI trailer go into the message before the
commit:
git interpret-trailers --if-exists addIfDifferent \
--trailer "Signed-off-by: Ana Souza <[email protected]>"
git commit -F -
Nothing is recorded while the message doesn't meet the rules. After the commit, the usual Ctrl+Z applies.
- "Checking the team rules failed: …": the check ran into an error and the commit goes ahead; the notice is only informative.
- "Couldn't add the trailers to the message: …": usually, the identity is missing ("No git identity (user.name and user.email): Signed-off-by can't be written."). The commit is canceled.
- "Protected branch": with
protected_mode: block, a direct commit to a protected branch is rejected ("main is protected and doesn't accept direct commits (…). Create a branch for your work and open a merge request."). See Checks.
- Preferences › Policy and team: the rules in effect and where each one came from.
.versora.yml(thecommit:key) and the company policy (commit_title_max,commit_conventional,commit_types,commit_signoff,ai_coauthor,ai_trailer). Each level can only tighten the one below it. See The .versora.yml file.
When you click commit, Versora runs the checks before calling git, in a fixed order: first the team and company rules, then the push rules, the identity and the message rules, and last the others (CI, secrets, large files, protected branch, line endings…). A check that cancels the commit ends the sequence: the following ones don't even get to ask. The remaining warnings show up together in a dialog, which lets you go back or go ahead.
- They run on their own with every commit. The bar shows "Checking before commit…".
- The Commit as line in the commit box: the email that goes into the commit and where it comes from (for example "global", "this repository" or "rule Company"). It turns yellow when there's something to check. Clicking it opens Preferences › Identities.
- Commit as usual.
- If a dialog shows up, read which check each item comes from (the group title says so, for example "Commit message (Conventional Commits)" or "Line endings").
- Fix it and commit again, or go ahead with the dialog's button (Commit anyway), when the check allows it.
What is checked and where it's explained:
| Check | What it looks at | Page |
|---|---|---|
| Team and company rules | Title, Conventional Commits, types, Signed-off-by, AI trailer, protected branch with blocking | Team rules in the commit box |
| Push rules | The GitLab rules, the .versora/push-rules.json rules and the local ones ("Before committing: push rules") | Checks |
| Identity | Name and email that go into the commit ("Before committing: identity") | Identity |
| Commit message | The repository's commitlint or required Conventional Commits | Conventional Commits |
| CI validation | The staged .gitlab-ci.yml ("CI validation (.gitlab-ci.yml)") | Pipelines |
| Secrets, large files, protected branch | What is staged ("Before committing") | Checks |
| Line endings | CRLF or mixed line endings going into the commit | Checks |
| Message template | The message is the same as commit.template (as it is in the file or with the variables replaced), with nothing filled in | Templates |
| "Don't commit" list | A file on the list is staged | The "don't commit" list |
- Without a name and email, "Git identity not configured" shows up before the commit is attempted.
- When an identity rule matches the repository but another setting overrides it, or when the repository belongs to the company and the email isn't from its domain, the "Before committing: identity" dialog shows up, with "The commit would be made as" and the options Use the identity of the "Company" rule in this repository (or Create rule…), Commit anyway and Back.
- Details in Identity: name and email.
The checks read the repository (configuration, what is staged) and, depending on the case, the GitLab or GitHub API. They don't record anything, except when you choose a fix (for example, saving the rule's identity in the local configuration, with the command shown beforehand).
Going back in a dialog cancels the commit; nothing changes in the repository.
- "Before committing" with Commit anyway: these are warnings; you decide.
- "The message doesn't follow the rules" and "Message breaks the rules": these are blocks; only Fix the message.
- A check that fails because of an internal error doesn't stop the commit.
- Preferences › Checks, Push rules, Identities, Versions and commits, Operations (line endings).