adds nice git interface
This commit is contained in:
+125
-129
@@ -1,163 +1,162 @@
|
||||
# Git
|
||||
|
||||
The Git column (Source Control) is the leftmost column of the window. It lists every changed file in the project's git repository, lets you stage and unstage them, and holds the commit box at its foot.
|
||||
The Git view is a full-screen page for everything git: it lists every changed file with an inline diff, stages and commits, pulls and pushes, switches branches, and shows each git command it runs in a console. Open it with `Cmd+G`.
|
||||
|
||||
[Guide index](index.md) · Related: [Git commit form](git-commit-form.md), [Right-click menu](right-click-menu.md), [Dialogs](dialogs.md), [File view: Diff](file-view-diff.md), [Status bar](status-bar.md)
|
||||
[Guide index](index.md) · Related: [Git commit form](git-commit-form.md), [Right-click menu](right-click-menu.md#git-rows), [Dialogs](dialogs.md), [Notifications](notifications.md), [Status bar](status-bar.md)
|
||||
|
||||
## At a glance
|
||||
|
||||
```text
|
||||
+-------------------------------------+
|
||||
| (1) STAGED CHANGES - 2 |
|
||||
| (2) [] app/Http |
|
||||
| (3) M [php] UserController.php +4 |
|
||||
| A [php] Invoice.php +31 |
|
||||
|-------------------------------------|
|
||||
| (1) CHANGES + 3 |
|
||||
| [] . |
|
||||
| M [md] README.md +2 -1 |
|
||||
| [] tests/Feature |
|
||||
| (4) M [php] UserTest.php [ + ] |
|
||||
| D [php] -OldTest.php- -12 |
|
||||
| |
|
||||
|-------------------------------------|
|
||||
| (5) Shift+Enter to commit |
|
||||
| |
|
||||
|-------------------------------------|
|
||||
| (6) Commit ^ | (7) ^ |
|
||||
+-------------------------------------+
|
||||
+----------------------------------------------------------------------------+
|
||||
| (1) [ git ] <> main 1 ahead of origin [Pull] [Push ^1] [Close CmdG] |
|
||||
|----------------------------------------------------------------------------|
|
||||
| (2) fix the login form_ |
|
||||
| Jonathan <jonathan@example.com> Cmd+Enter commits [Commit 2 files|v] |
|
||||
|----------------------------------------------------------------------------|
|
||||
| (3)|v staged (2) [ ] [Unstage all]|
|
||||
| |> [M] app/Http/UserController.php +4 -1 [Unstage] |
|
||||
| |> [A] app/Models/Invoice.php +31 -0 [Unstage] |
|
||||
| |
|
||||
| (3) v changed (1) [Discard all] [Stage all]|
|
||||
| (4) v [M] README.md +2 -1 [Discard] [Stage] |
|
||||
| (5) 12 | old line || 12 | new line |
|
||||
| 13 | same line || 13 | same line |
|
||||
| ... 40 unchanged lines |
|
||||
| v new . untracked (1) [Delete all] [Stage all]|
|
||||
| v deleted (1) [Restore all] [Stage all]|
|
||||
|----------------------------------------------------------------------------|
|
||||
| (6) [ console ] git (x) | (7) [ branches ] clean . ... |
|
||||
| $ git add -- README.md | local |
|
||||
| $ git commit -m "fix the login form" | |<> main current |
|
||||
| $ git _ | <> feature/a switch -> |
|
||||
| | remote . origin |
|
||||
| | () origin/feature/b checkout->|
|
||||
+----------------------------------------------------------------------------+
|
||||
```
|
||||
|
||||
1. **Group header**: `Staged Changes` or `Changes`, with the row count in amber on the right. Hover the header to see its quick action: `-` (Unstage all) or `+` (Stage all).
|
||||
2. **Folder line**: the folder that the rows below it live in. `.` is the project root.
|
||||
3. **Row**: status letter, file-type badge, file name, and line counts.
|
||||
4. **Hover quick action**: a `+` or `-` that replaces the line counts while you hover or select the row.
|
||||
5. **Commit message**: see [Git commit form](git-commit-form.md).
|
||||
6. **Commit button**: see [Git commit form](git-commit-form.md).
|
||||
7. **Push button**: see [Git commit form](git-commit-form.md).
|
||||
1. **Top bar**: the branch, where it stands against origin, and the Pull, Push and Close buttons.
|
||||
2. **Commit block**: the message, the author and the Commit button. See [Git commit form](git-commit-form.md).
|
||||
3. **Section header**: the section name, its row count, and the bulk actions.
|
||||
4. **File row**: status badge, path, line counts and the row actions.
|
||||
5. **Inline diff**: the last commit on the left, the working tree on the right.
|
||||
6. **Console**: every git command the view runs, with its output, and an input line for your own.
|
||||
7. **Branches**: local branches and the branches on origin.
|
||||
|
||||
## Features
|
||||
|
||||
### Two groups: staged and unstaged
|
||||
### Open and close the view
|
||||
- `Cmd+G`, the **Git** toggle in the [Title bar](title-bar.md), or View > Show Git opens it. The toggle reads `Git N`, where N counts the changed files.
|
||||
- The view covers the whole window: title bar, columns and status bar. The columns stay as they were under it. Terminals keep running.
|
||||
- When it opens, the keyboard goes to the commit message.
|
||||
- `Cmd+C` with no text selected, outside a terminal, also opens the view on the commit message.
|
||||
- Close it with `Cmd+G`, `Esc`, or the **Close** button. The keyboard goes back to the column that had it.
|
||||
- Dialogs, right-click menus, [Search](search.md), the full-screen [Diff](file-view-diff.md) and [notifications](notifications.md) show on top of the view. `Esc` closes those first, then the view.
|
||||
- While the view is open, the column keys rest (arrows, `Cmd+Left` / `Cmd+Right`). `Cmd+1`, `Cmd+2` and `Cmd+3` still toggle the columns under it.
|
||||
- The view is not remembered: a project always opens with it closed.
|
||||
|
||||
- **Staged Changes** sits on top. It lists what the next commit will hold.
|
||||
- **Changes** sits below. It lists edits in the working tree that are not staged yet.
|
||||
- Each group shows its row count on the right of its header.
|
||||
- Inside a group, rows are grouped by folder. Each folder gets a small folder line with its path. Hover a folder line to see the full path; the project root reads `.`.
|
||||
- One file can show up twice: once in Staged Changes and once in Changes. That happens when you staged a file and then edited it again. Each row stands for its own half of the change.
|
||||
### Top bar
|
||||
- `[ git ]`, then the current branch in amber.
|
||||
- Next to it, where the branch stands against its remote: `in sync with origin`, `1 ahead of origin`, `2 behind origin`, `1 ahead · 2 behind origin`, or `no upstream`.
|
||||
- **Pull** shows `↓N` when there are commits to pull. **Push** shows `↑N` when there are commits to push.
|
||||
- Opening the view runs `git fetch origin`, so the ahead and behind numbers are up to date. A repository without an `origin` skips this.
|
||||
|
||||
There is no column header or title. The column starts with the first group.
|
||||
### Sections
|
||||
The changes sit in up to four sections, in this order. A section with no rows is left out.
|
||||
|
||||
### Row anatomy
|
||||
| Section | Colour | What it holds | Row actions | Bulk actions |
|
||||
|---|---|---|---|---|
|
||||
| **staged** | amber | Everything staged for the next commit, whatever its status | Unstage | Unstage all |
|
||||
| **changed** | light amber | Unstaged edits to tracked files; also renames and conflicts | Discard, Stage | Discard all, Stage all |
|
||||
| **new · untracked** | teal | New files git does not track yet | Delete, Stage | Delete all, Stage all |
|
||||
| **deleted** | lilac | Tracked files deleted from disk | Restore, Stage | Restore all, Stage all |
|
||||
|
||||
- Click a section header to fold or unfold it.
|
||||
- One file can show up twice: once in staged and once in another section. That happens when you staged a file and then edited it again. Each row stands for its own half.
|
||||
- A conflicted row (`U`) only offers **Stage**. Staging it marks the conflict as resolved.
|
||||
|
||||
### File rows
|
||||
Every row, left to right:
|
||||
|
||||
- **Status letter** (see the table below).
|
||||
- **File-type badge**, the same badge the [Explorer](explorer.md) uses.
|
||||
- **File name**. A deleted file has its name struck through and dimmed. Files under `tests/` or `cypress/` show in a dimmer grey, so source files stand out.
|
||||
- **Line counts** on the far right: `+N` in teal for added lines, `−N` in amber-deep for removed lines. A count of zero is left out.
|
||||
- A chevron: click anywhere on the row to show or hide its inline diff.
|
||||
- A status badge: `A` new, `M` modified, `D` deleted, `R` renamed, `U` conflict. Hover it for the word.
|
||||
- The path: the folder dim, the file name bright. A deleted file is struck through.
|
||||
- The line counts: `+N` in teal and `−N` in light amber.
|
||||
- The row actions, from the table above.
|
||||
|
||||
Hover a row to see its full project-relative path in a tooltip.
|
||||
Staged rows carry an amber bar on their left edge.
|
||||
|
||||
### Status letters and colours
|
||||
### Row actions
|
||||
- **Stage** and **Unstage** run at once. They never ask.
|
||||
- **Discard** throws away the unstaged changes of a file. The file goes back to its staged version, or to the last commit when nothing is staged.
|
||||
- **Delete** removes a new file from disk.
|
||||
- **Restore** brings a deleted file back.
|
||||
- Discard and Delete ask first by default (`git.confirmDiscard`). See [Dialogs](dialogs.md#discard-changes). Restore never asks.
|
||||
- An open file in the [File view](file-view.md) reloads after a Discard, Delete or Restore.
|
||||
|
||||
| Letter | Meaning | Colour in Staged Changes | Colour in Changes |
|
||||
|---|---|---|---|
|
||||
| `A` | Added: a new file, also an untracked one or a copy | teal | amber |
|
||||
| `M` | Modified; a merge conflict also reads `M` | teal | amber |
|
||||
| `D` | Deleted | teal | amber-deep |
|
||||
| `R` | Renamed | teal | light grey |
|
||||
### Inline diff
|
||||
- The last commit (or the staged version) is on the left, the working tree on the right, lines side by side.
|
||||
- Removed lines have an amber tint, added lines a teal tint. In a changed line pair, the part that differs is highlighted.
|
||||
- Each change keeps 3 unchanged lines around it. Longer unchanged runs fold into `⋯ N unchanged lines`.
|
||||
- A file over 1 MB shows `Too big.`. A file with no text changes shows `— No line changes.`.
|
||||
- For the full-screen comparison, open the file and use the [Diff](file-view-diff.md).
|
||||
|
||||
Staged letters are always teal, whatever the status. Unstaged letters follow the status. A merge conflict shows as one `M` row in Staged Changes, because git cannot stage half of a conflict.
|
||||
### Right-click a row
|
||||
Right-click a file row for **Open in editor**, **Pass on reference** and **Copy reference**. See the [right-click menu](right-click-menu.md#git-rows). Open in editor and Pass on reference close the view first.
|
||||
|
||||
### Open a file from a row
|
||||
### Pull and push
|
||||
- **Pull** runs `git pull --no-rebase`. When your branch and origin both have new commits, git merges them.
|
||||
- **Push** runs `git push`, or `Cmd+P` from anywhere. A branch with no upstream yet is pushed again with `git push -u origin <branch>`, so the next push needs nothing extra.
|
||||
- While one runs, its button reads `Pulling…` or `Pushing…` and the console header says so. A second Pull or Push is ignored until it ends.
|
||||
- Pull and push stop after 120 seconds.
|
||||
- Helder never asks for a password. Git must already have access to the remote, for example through an SSH key or a credential helper.
|
||||
- A [notification](notifications.md) says how it ended, for example `Pushed 2 commits to origin/main` or `Push failed` with git's error line.
|
||||
|
||||
- **Click** a row to open that file in the [File view](file-view.md). It opens on the live file, not the full-screen Diff.
|
||||
- The row remembers which half you clicked. When the file has rows in both groups, the Diff for that file then compares just that half: `HEAD → staged` for a staged row, `staged → actual` for an unstaged row.
|
||||
- The row of the open file stays highlighted.
|
||||
- To go straight into the full-screen Diff, use **Open diff** in the [right-click menu](right-click-menu.md#git-rows).
|
||||
### Console
|
||||
- Every action in the view logs the exact git command, such as `$ git add -- README.md`, and then git's output as it arrives.
|
||||
- Errors read in amber, hints dim, staged and unstaged files from `status` in their colours, and a pushed branch in teal.
|
||||
- Type your own command after `$ git` and press `Enter`. A leading `git` is allowed: `status` and `git status` do the same.
|
||||
- `clear` empties the console. So does the eraser button in its header.
|
||||
- `log` on its own shows the last 30 commits, one line each.
|
||||
- `Up` brings back the commands you typed before, newest first.
|
||||
- Commands run one at a time, in order. Typed commands also stop after 120 seconds.
|
||||
- Git cannot ask you anything here: there is no editor and no pager. A command that needs an editor, such as `commit` without `-m`, stops with git's error.
|
||||
- Click the console log without selecting text to put the cursor on the input line.
|
||||
- The console keeps the last 400 lines.
|
||||
|
||||
### Stage and unstage one file
|
||||
### Branches
|
||||
- **local** lists your local branches. **remote · origin** lists the branches on origin.
|
||||
- The current branch has an amber bar and reads `current`. A remote branch that has a local branch reads `tracked`.
|
||||
- Click a branch to switch to it (`switch →`).
|
||||
- Click a remote branch with no local branch to check it out (`checkout →`). Git creates a local branch that tracks it.
|
||||
- Switching is locked while there are uncommitted changes. The header then reads `— N uncommitted files · switching locked`, the other branches are dimmed, and a click shows a notification that asks you to commit or discard first.
|
||||
|
||||
- Hover a row. Its line counts make way for a quick action button:
|
||||
- `+` on a row in Changes: **Stage changes**.
|
||||
- `−` on a row in Staged Changes: **Unstage changes**.
|
||||
- Click the button. The row moves to the other group.
|
||||
- The same actions sit in the [right-click menu](right-click-menu.md#git-rows).
|
||||
- By default there is no confirmation. Turn on `git.confirmStage` or `git.confirmUnstage` to get a [confirm dialog](dialogs.md#confirm-dialog) first.
|
||||
|
||||
### Stage all and unstage all
|
||||
|
||||
- Hover the **Changes** header and click `+` (**Stage all**). Every unstaged file is staged.
|
||||
- Hover the **Staged Changes** header and click `−` (**Unstage all**). Every staged file goes back to Changes.
|
||||
- The button only shows while the group has rows.
|
||||
- Stage all and Unstage all never ask for confirmation.
|
||||
|
||||
### Discard changes
|
||||
|
||||
- Right-click a row and choose **Discard changes**. See the [right-click menu](right-click-menu.md#git-rows).
|
||||
- It asks first by default (`git.confirmDiscard`). See [Dialogs](dialogs.md#discard-changes).
|
||||
- A file that exists in the last commit goes back to that version, in the staging area and on disk. Both its staged and its unstaged changes are gone.
|
||||
- A file that is not in the last commit (a new file) is unstaged and deleted from disk.
|
||||
- A staged rename also gets its old file back.
|
||||
- An open file reloads from disk after a discard.
|
||||
|
||||
### Row cursor and keyboard
|
||||
|
||||
The column has a keyboard cursor: one highlighted row.
|
||||
|
||||
- Click the column, or move focus to it with `Cmd+Left` / `Cmd+Right`, to make it the active column.
|
||||
- `Up` and `Down` move the cursor through the rows: first all staged rows, then all unstaged rows, folder by folder.
|
||||
- `Enter` opens the row under the cursor, the same as a click.
|
||||
- `Cmd+Right` opens the row's [right-click menu](right-click-menu.md#git-rows), beside the column at the row's height.
|
||||
- Hovering a row with the pointer also moves the cursor to it.
|
||||
- When the cursor's row disappears, for example after a commit, the next `Up` or `Down` starts again at the top.
|
||||
|
||||
### Empty states
|
||||
|
||||
- **Not a repository**: the column shows `— Not a git repository.` and nothing else. The commit box stays at the foot.
|
||||
- **Clean working tree**: the column shows `— No changes. The working tree is clean.`
|
||||
- **Nothing staged**: under the Staged Changes header, `— Nothing staged.`
|
||||
- **Everything staged**: under the Changes header, `— All changes are staged.`
|
||||
|
||||
### Branch and totals
|
||||
|
||||
The column itself shows no branch. The current branch, the line totals of all changes, and the staged and unstaged counts sit on the left of the [Status bar](status-bar.md). The branch cannot be switched from Helder.
|
||||
### When the view is empty
|
||||
- **Not a repository**: `— Not a git repository.`
|
||||
- **Clean working tree**: `— No changes. The working tree is clean.`
|
||||
|
||||
### Worktrees
|
||||
|
||||
A project folder that is a git worktree (or a submodule) works like a normal repository. Helder finds the real git folder and watches it for changes. There is no worktree list or worktree switcher.
|
||||
|
||||
### How the list stays up to date
|
||||
|
||||
You do not need to refresh by hand. The list updates by itself:
|
||||
|
||||
- **On every change**: Helder watches the project folder and the git folder. Edits by you, by the agent, or by git in a terminal update the list after a short pause.
|
||||
- **On a timer**: as a backstop, git is re-read every 10 seconds by default (`git.refreshInterval`).
|
||||
- **When you click into the column**: moving focus into the Git column from another column re-reads git.
|
||||
- **After every action**: stage, unstage, discard, commit and push all re-read git when they finish.
|
||||
- **By hand**: `Cmd+R` (View → Refresh) re-reads git, the file tree and the open file. The column flashes briefly to show it.
|
||||
|
||||
When a git action fails, a [notification](notifications.md) names the action, for example `Stage failed`, with the file or git's own error line.
|
||||
|
||||
### Show or hide the column
|
||||
|
||||
- `Cmd+G`, or the **Git** toggle in the [Title bar](title-bar.md), shows or hides the column.
|
||||
- `Cmd+C` (with no text selected and outside a terminal) shows a hidden column and puts the cursor in the commit message.
|
||||
- See [Layout](layout.md) for column widths and splitters.
|
||||
- **When the view opens**: git is re-read, then origin is fetched.
|
||||
- **After every action**: every git command from the view, typed ones included, re-reads git and the branches when it ends. Pull, a branch switch and typed commands also re-read the file tree and the open file.
|
||||
- **By hand**: `Cmd+R` (View > Refresh) re-reads git, the file tree and the open file.
|
||||
|
||||
## Keyboard
|
||||
|
||||
| Keys | Action |
|
||||
|---|---|
|
||||
| `Up` / `Down` | Move the row cursor (Git column active) |
|
||||
| `Enter` | Open the row under the cursor |
|
||||
| `Cmd+Right` | Open the right-click menu of the row under the cursor |
|
||||
| `Cmd+Left` / `Cmd+Right` | Move focus to the column on the left or right |
|
||||
| `Cmd+C` | Focus the commit message (no text selected, not in a terminal) |
|
||||
| `Cmd+Enter` | Commit the staged files |
|
||||
| `Cmd+G` | Open or close the Git view |
|
||||
| `Esc` | Close the Git view (after any dialog, menu, search or Diff on top of it) |
|
||||
| `Cmd+C` | Open the view on the commit message (no text selected, not in a terminal) |
|
||||
| `Cmd+Enter` | Commit, while the view is open (not from the console input) |
|
||||
| `Cmd+P` | Push the current branch |
|
||||
| `Cmd+G` | Show or hide the Git column |
|
||||
| `Enter` | Run the command in the console input |
|
||||
| `Up` | Recall the previous console command |
|
||||
| `Cmd+R` | Re-read git, the file tree and the open file |
|
||||
|
||||
## Settings
|
||||
@@ -166,20 +165,17 @@ All settings live in `.helder/config.json`. See [Configuration](configuration.md
|
||||
|
||||
| Setting | Default | Effect |
|
||||
|---|---|---|
|
||||
| `git.confirmDiscard` | `true` | Ask before Discard changes |
|
||||
| `git.confirmStage` | `false` | Ask before staging one file |
|
||||
| `git.confirmUnstage` | `false` | Ask before unstaging one file |
|
||||
| `git.confirmDiscard` | `true` | Ask before Discard and Delete |
|
||||
| `git.refreshInterval` | `10000` | Milliseconds between automatic git re-reads; `0` turns the timer off |
|
||||
| `git.defaultDiffMode` | `updated` | How a changed file opens; see [File view: Diff](file-view-diff.md) |
|
||||
|
||||
## Related
|
||||
|
||||
- [Git commit form](git-commit-form.md): the message field, Commit and Push at the foot of this column.
|
||||
- [Right-click menu](right-click-menu.md#git-rows): every action on a git row.
|
||||
- [Dialogs](dialogs.md): the confirm dialog for discard, stage and unstage.
|
||||
- [File view](file-view.md): where a clicked row opens.
|
||||
- [File view: Diff](file-view-diff.md): the full-screen comparison behind Open diff.
|
||||
- [Git commit form](git-commit-form.md): the message, author and Commit button at the top of the view.
|
||||
- [Right-click menu](right-click-menu.md#git-rows): the menu on a file row.
|
||||
- [Dialogs](dialogs.md): the confirm dialog for Discard and Delete.
|
||||
- [File view: Diff](file-view-diff.md): the full-screen comparison of one file.
|
||||
- [Explorer](explorer.md): shows the same status letters in the file tree.
|
||||
- [Status bar](status-bar.md): branch, line totals and counts.
|
||||
- [Notifications](notifications.md): the messages after a commit, push or failed action.
|
||||
- [Status bar](status-bar.md): branch, line totals and counts while the view is closed.
|
||||
- [Notifications](notifications.md): the messages after a commit, pull, push or branch switch.
|
||||
- [Keyboard shortcuts](keyboard-shortcuts.md): every shortcut in one list.
|
||||
|
||||
Reference in New Issue
Block a user