Back to Fresh

Git

docs/features/git.md

0.4.33.3 KB
Original Source

Git

Palette: Review Diff, Review: Commit Range, Review: PR Branch, Git Log, Next Diff Chunk, Previous Diff Chunk. Run Keybinding Editor to see or change the keys.

Fresh has built-in tooling for reviewing diffs, navigating git history, and jumping between changes. Everything here is driven from the command palette.

  • Review Diff — unified buffer of working-tree hunks, with stage / unstage / discard on the cursor row.
  • Review: Commit Range / PR Branch — same buffer against an arbitrary range or a branch's commits.
  • Git Log — magit-style log with a live-preview diff panel on the right.
  • Git Blame — magit-style blame for the current file.
  • Diff Chunk Navigation — jump between hunks from git or saved diff files with the same commands.

Review Diff

Review Diff opens a unified buffer that lists files and their diffs in a single scrollable view. The file list sits at the top; each file's hunks follow and can be collapsed. The buffer is the same kind of buffer the editor uses everywhere else, so scrolling, search, and splits all work as normal.

Entry points (all in the command palette):

  • Review Diff — everything staged, unstaged, and untracked in the working tree right now.
  • Review: Commit Range — any range expression, e.g. main..feature or HEAD~5...HEAD.
  • Review: PR Branch — walk a branch's commits, with a side-by-side git show for the currently selected commit.

Inside a review:

  • n / p jump to the next and previous hunk.
  • Stage, unstage, or discard the hunk, file, or a line-level visual selection on the cursor row.
  • Comments — leave a line comment or a review-wide note. Comments persist per repository across editor restarts, so you can close the editor mid-review and pick up where you left off. A dedicated Comments panel lets you jump through them, edit, delete, or export to Markdown.

Git Log

Git Log opens a live-preview commit history. Moving through the log updates the right panel with the diff for the selected commit — no need to open each one to see what it touched. Commit messages wrap, columns align, and the toolbar is clickable. Git Log (Current File) scopes the history to the active buffer's file.

Git Blame

Git Blame opens a magit-style blame for the current file. It lands on the line you were on when you ran it (multi-byte text included). Git Blame: Go Back re-blames at the parent commit of the current line so you can walk a line's history; Git Blame: Close dismisses the panel.

Live Diff

Live Diff marks changed lines in the gutter as you edit, comparing the buffer against a reference. Toggle it with Live Diff: Toggle, and choose the reference with Live Diff: vs HEAD, vs Disk, or vs Branch…. When a changed line closely matches its original, the change is shown inline with word-level highlighting rather than as a separate removal and addition.

Diff Chunk Navigation

The built-in Diff Chunk Navigation plugin merges two sources of hunks — the active git diff and any saved diff files — so you can jump between changes the same way in either context. It adds commands like Next Diff Chunk and Previous Diff Chunk to the palette.

See it in action: Review Diff and Git Log in the 0.3.0 blog post.