Tutorial: your first commit

Install, stage, review and commit. About five minutes.

Requirements

Linux on x86_64, and a git repository with some history, so there is a style to learn.

1. Install

$ curl -fsSL https://raw.githubusercontent.com/Lucas-BRT/smart-commit/main/install.sh | bash

The setup lists your hardware, asks before anything that needs sudo, downloads the model and ends with a benchmark. When a device shows <- selected, you are ready.

2. Stage your changes

git add src/retry.rs
# or, hunk by hunk
git add -p

Use what you already use. -p is handy to keep each commit focused, but it is not required.

smart-commit only reads what is staged. With nothing staged it stops with an error. During a merge, a revert or a cherry-pick it keeps the message git prepared.

3. Preview the message (optional)

$ smart-commit
feat(retry): add a retry loop

This only prints a suggestion, in the style of your history. It does not commit anything, so you can skip it.

4. Review and commit

┌ Commit message ──────────────────────┐
│feat(retry): add a retry loop         │
│                                      │
│Retries failed requests three times.  │
└──────────────────────────────────────┘
 qwen2.5-coder-1.5b on cpu · 1.6 s
┌ Staged: 2 files ─────────────────────┐
│ M src/retry.rs                       │
│ R src/http.rs -> src/net.rs          │
└──────────────────────────────────────┘
[Enter] commit  [e] edit, then commit  [a] another message  [q] cancel

Nothing is committed until you press a key.

  • Enter commits with this message.
  • e lets you edit it first.
  • a asks for another message.
  • q cancels. You can also ignore the suggestion and write your own with git commit.

5. Make it automatic (optional)

smart-commit hook install
# the editor opens with the message written
git commit

Edit it or replace it. The hook only acts on a plain git commit, and never blocks one. smart-commit hook uninstall removes it.

Next

Devices · How it works · the usage guide