All posts

Guides3 min read

Build a commit one difference at a time

Tick individual differences in the Changes tab's Include view to build a commit straight in the git index, and revert the ones you don't want.

The Changes tab has a second way to build a commit. Instead of moving files between Unstaged and Staged lists, the Include view shows each file once, as one diff from HEAD to your working tree, with a checkbox on every difference. Tick what belongs in this commit and leave the rest.

The Include view selected in the changes panel, with one list of changed files and a checkbox on each

Switch to the Include view

  1. Open the Changes tab.
  2. In the changes panel on the right, under the changes count, choose Include in the Staging area / Include switch.
  3. The panel now lists every changed file once. Select one to open its diff.

GitLane remembers the view you picked. Staging area is the default (since v2.4.1) and still has the separate Unstaged and Staged lists, with Stage and Unstage on each file, hunk and line. See Staging and committing for that view.

Pick what goes into the commit

  1. Each file in the list has a checkbox: checked when the whole file is included, partly checked when only some of its differences are, and unchecked when none are. Click it to include or exclude the whole file. The checkbox beside the Changes heading does the same for every file.
  2. In the diff, each difference has its own checkbox. Click it to include or exclude exactly those lines.
  3. The toolbar above the diff keeps count, for example “3 differences, 1 included”.
  4. Commit as usual. Only what you included goes into the commit.

There is no separate selection to keep in sync: every checkbox writes straight to the git index. Run git status or git diff --cached in a terminal and it matches what you see, and a git add in that terminal shows up in the checkboxes.

Unchecked boxes stay out of the way until you hover their row or focus them, and checked ones use a soft accent tint (since v2.6.2).

Throw away a difference you don't want

  1. Exclude the difference first. » is offered only on an excluded difference.
  2. Click » next to its checkbox.
  3. GitLane asks Revert this difference? Choose Revert to put those working-tree lines back to the index version.

The revert only touches your working tree. Content you have already staged stays as it is, which is why a difference that is fully or partly included can't be reverted until you exclude it.

See the whole file

Whole file in the toolbar shows every line of the file instead of just the changed regions, and every checkbox and » still works. A very long file falls back to its changes, with a note saying so.

In split view the two sides are labelled HEAD · <sha> and Working tree. Edited lines highlight the words that changed inside them.

The pencil in the same toolbar opens the file in the editor; closing it brings you back here.

Move around without the mouse

Action How
Previous / next difference (carries on into the neighbouring file) ⌥↑ / ⌥↓
Previous / next changed file ⌥← / ⌥→

On Windows and Linux use Alt instead of ⌥. The arrow buttons in the diff toolbar do the same, and the toolbar shows which file you are on, such as “2/5 files”. The rest of the keys are in Keyboard shortcuts.

Good to know

Reverting a difference with » can't be undone. GitLane asks first, and it never touches what you have staged.

  • Some changes can only be included as a whole file. Their diff shows the reason and no per-difference checkboxes; use the file's checkbox instead. If a difference's checkbox is greyed out, its tooltip points you to the Staging area view.

Shipped in GitLane v2.4.0.

Installers: Download GitLane.