Improves Git's user interface

This commit is contained in:
2026-11-24 16:43:20 +01:00
parent 2887965a9e
commit 28079e80c5
6 changed files with 114 additions and 26 deletions
+9 -7
View File
@@ -62,13 +62,13 @@ Opening the view reads the author and the branches, re-reads git and runs `git f
### Commit block
- The **commit message**: always one lowercase line. Capitals become lowercase and line breaks become spaces as the user types or pastes, so `Enter` never starts a second line. The field grows with wrapped text from 56 to 180 points. An amber underline shows focus.
- **Gen. Commit Message**, a small secondary button with the pass-on spark, first on the left of the footer. It asks the Claude CLI for a message for the **staged** changes and puts the answer in the message field, replacing the draft, then focuses the field. The answer goes through the same one-lowercase-line rule as typed text.
- The **commit message**: always one lowercase line. Capitals become lowercase and line breaks become spaces as the user types or pastes, so `Enter` never starts a second line. The field grows with wrapped text from 56 to 180 points. The text and the `Commit message` placeholder are right-aligned. An amber underline shows focus.
- **Gen. Commit Message**, a small secondary button with the pass-on spark, on the right of the footer just before **Add, Stage & Commit**. It asks the Claude CLI for a message for the **staged** changes and puts the answer in the message field, replacing the draft, then focuses the field. The answer goes through the same one-lowercase-line rule as typed text.
- The prompt holds the writing rules (one sentence, no quotes, no prefix, no body, English, a verb in the third person or past tense, two separate changes joined with ` - `), three example messages, `git diff --cached --stat` in full and `git diff --cached` cut after 60 000 characters (the prompt says when it is cut).
- It runs `claude -p --output-format text --no-session-persistence --strict-mcp-config --disable-slash-commands --tools ""` with the prompt on stdin, in the project root, with the CLI's default model and no tools; `claude` is looked up on PATH, Homebrew, `~/.local/bin` and `~/.claude/local`. The run times out after 90 seconds. The first non-empty line of the answer, without surrounding quotes or backticks, becomes the message.
- While it runs the label reads `Generating…` and a second click is ignored. It is disabled (dimmed, arrow cursor) when nothing is staged or while it runs.
- A failure leaves the draft alone and toasts `Couldn't generate a commit message` with the reason: `claude not found`, the CLI's first error line, or `timed out`.
- The **author**, `user.name <user.email>` from git config.
- The **author**, `user.name <user.email>` from git config, first on the left; it truncates when space runs out.
- A `⌘↵ commits` hint.
- Three buttons side by side: **Add, Stage & Commit** and **Commit** (`Commit N files`, or `Nothing staged`), both secondary buttons with a hairline border, and **Commit and push**, the primary one. Commit and push is amber when something is staged and the message is not empty, grey otherwise. With nothing staged Commit and Commit and push are disabled: dimmed, the arrow pointer, and a click does nothing.
- **Add, Stage & Commit** stages every unstaged path (edits, deletions and new files) with `git add -- <paths>`, then commits as **Commit** does, without a push. With an empty message it stages nothing, runs no git, and the message field takes the focus. It is disabled when there are no changes at all, during a merge conflict (staging a conflicted file marks it resolved), and while a push or pull runs. When `git add` fails, no commit runs.
@@ -92,21 +92,23 @@ Four colour-coded sections, each only when it has rows, in this order:
### Bottom strip
230pt tall: the console left, the branches right, sharing the width equally up to 820pt each. When the room left over is at least 260pt, the **commits** list fills it, after a hairline; otherwise that room stays empty.
From a window 1600pt wide there is no strip: under the top bar three full-height columns, the **branches** over the **commits** on the left (480pt, half the height each, a hairline between), the commit block and sections in the middle, the **console** on the right (560pt). Hairlines separate the columns.
Narrower, a 230pt strip under the sections: the console left, the branches right, sharing the width equally up to 820pt each. When the room left over is at least 260pt, the **commits** list fills it, after a hairline; otherwise that room stays empty.
### Console
The bottom-left panel. Every action logs the exact git command (`$ git add -- path`) and streams its output line by line, coloured by kind: errors, hints, staged and unstaged lines of `status`, and the ref update of a push. Below the log, a `$ git` input runs typed commands, with or without a leading `git`. `clear` empties the log, a bare `log` runs `log --oneline --decorate -n 30`, and `Up` recalls earlier input. Commands, typed or from buttons, run one at a time. The log keeps the last 400 lines.
The bottom-left panel, or the right column from 1600pt. Every action logs the exact git command (`$ git add -- path`) and streams its output line by line, coloured by kind: errors, hints, staged and unstaged lines of `status`, and the ref update of a push. Below the log, a `$ git` input runs typed commands, with or without a leading `git`. `clear` empties the log, a bare `log` runs `log --oneline --decorate -n 30`, and `Up` recalls earlier input. Commands, typed or from buttons, run one at a time. The log keeps the last 400 lines.
### Branches
The bottom-right panel: **local** branches, then **remote · origin**. The current branch is marked; a remote branch with a local counterpart reads `tracked`. A click switches (`switch →`); a remote branch without a local one is checked out as a new tracking branch (`checkout →`). While there are uncommitted changes, switching is locked: the header says so, the other branches dim, and a click shows a toast instead of running git.
The bottom-right panel, or the top of the left column from 1600pt: **local** branches, then **remote · origin**. The current branch is marked; a remote branch with a local counterpart reads `tracked`. A click switches (`switch →`); a remote branch without a local one is checked out as a new tracking branch (`checkout →`). While there are uncommitted changes, switching is locked: the header says so, the other branches dim, and a click shows a toast instead of running git.
**Right-click** a branch other than the current one: the menu, headed by the branch name, has one item, **Merge into <current>**, which runs `git merge --no-edit <branch>` (local and `origin/` branches alike). With uncommitted changes the item is disabled: dimmed, with the arrow and the tooltip `Commit or discard your changes first`; `Up`/`Down` skip it and a click does nothing. The current branch opens no menu. The merge always asks first, `Merge <branch> into <current>?`, and runs only on **Merge**. A merge that stops on conflicts says `Merge conflict — resolve, then commit`.
### Commits
The bottom strip's right end on a wide window, headed `[ commits ]` with the current branch muted on the right. A scrolling list of the last 30 commits of the current branch (HEAD), newest first, one row each: the short hash (amber), the subject on one line, and right-aligned `author · 3 h ago`. The relative time ticks along. Rows are read-only: no click, no hover, the arrow cursor. A repository without commits reads `no commits yet`; outside a repository `— no repository`.
Under the branches in the left column from 1600pt; narrower, the bottom strip's right end when there is room. Headed `[ commits ]` with the current branch muted on the right. A scrolling list of the last 30 commits of the current branch (HEAD), newest first, one row each: the short hash (amber), the subject on one line, and right-aligned `author · 3 h ago`. The relative time ticks along. Rows are read-only: no click, no hover, the arrow cursor. A repository without commits reads `no commits yet`; outside a repository `— no repository`.
The list is read when the view opens and after every command, with the branches.