Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 3.8 KB

commit-selection.md

File metadata and controls

66 lines (50 loc) · 3.8 KB

Selecting commits in a Git range

When reviewing a Git range, open Diff and choose commit, or press C to open the commit list directly. The list is ordered newest first. Choosing commits changes the displayed diff within the current review.

Opening the list

Current view Action Result
all or round Enter or click a row Close the list and show that commit.
all or round Space Enter range selection. Check the current row as both ends of the range and keep the list open.
commit Open the list Enter range selection with the saved interval checked.

The list reserves space for the checkboxes in both modes so that entering range selection keeps the commit IDs aligned.

Editing a range

Space and a click on a row have the same effect in range selection. The first and last rows below refer to their positions from top to bottom in the list. Every row between them is checked.

Row activated Effect
Any row when all boxes are clear Check that row.
Above the first checked row Extend the range up to this row.
First checked row Uncheck it. The following checked row becomes first. Removing the only checked row clears the selection.
After the first checked row, up to and including the last Uncheck this row and every row below it. The previous row becomes last.
Below the last checked row Extend the range down through this row.

The selector previews the checked IDs as you edit, or all when the boxes are clear. The diff changes only when you confirm. Moving the cursor or scrolling the list leaves the checkboxes as they are. Cancel and Save stay at the bottom of the menu while the rows scroll.

  • Esc or Cancel discards the edits and restores the view that was open before the menu.
  • Enter, Ctrl+s or Save applies the checked range and closes the menu. An empty selection switches to all, including when the menu was opened from round.

Reading the result

For one checked row the selector shows its short ID. For several it shows topID-bottomID in list order. The combined diff compares the first parent of the bottom commit with the top commit, so it includes the changes at both ends of a linear history. A root commit uses the empty tree. On a history with merges the two trees determine the result.

For example, if A adds a file, B edits it and C deletes it, checking A and B shows the file as added with B's contents. Extending the range through C produces an empty diff for that file.

The Commit panel lists every checked commit, newest first. Its tab shows the endpoint IDs and quoted subjects. Each entry has its own SHA copy button, author, date, message and file statistics against its first parent. Click the panel or press c to focus it.

  • Scroll with the arrows, Page Up, Page Down or the mouse wheel; press n or N to place the next or previous entry's SHA at the top of the panel.
  • Click a file path, or press o or Alt+o on its row, to focus its content tab. If the file is absent from the combined diff, the link opens the individual commit.
  • Drag across text to select characters. To select whole rows, drag in the left gutter or press v and move. Press Y or Alt+w to copy. With no selection, these keys copy the SHA of the current entry.
  • Search the log with / or ?. Ctrl+s and Ctrl+r step between matches. Enter keeps the current position and Esc restores the starting position.

The panel normally uses at least eight rows. Its maximum height is the larger of 15 rows or a quarter of the terminal height, subject to space for the rest of the review.

Comments retain the comparison they were written against. A multi-commit comment includes the base object ID as well as the head SHA so the agent can reconstruct both sides.