Beta Coming soon. This feature is still being built, so names and details may change before it ships.

Diff viewer & smart merge

The Ingot diff viewer applies or reverts each change with gutter arrows, accepts or rejects a whole file, and smart-merges conflicts in a three-way view.

Every action has a shortcut. Open the viewer by double-clicking a file under Local Changes (⌘K, Ctrl+K), in the Commit window, or in the Agent review block under an agent run in the chat. The header counts Change 1 of 3, and the changed files are listed on the side.

The diff viewer side by side: >> arrows in the left gutter and << arrows in the right gutter for each change, with Reject all and Accept all in the headerThe diff viewer side by side: >> arrows in the left gutter and << arrows in the right gutter for each change, with Reject all and Accept all in the header
The diff viewer side by side: >> arrows in the left gutter and << arrows in the right gutter for each change, with Reject all and Accept all in the header

Apply or revert each change

Every change gets two arrows in the gutter, like the diff viewer of a desktop IDE:

ArrowWhereWhat it does
»left gutterRevert this change: the old text goes back into your file, which is saved. Undo works as usual (⌘Z, Ctrl+Z).
«right gutterApply this change: you keep it. The change leaves the list and stays applied when you open the viewer again.

In Unified mode both arrows sit in the one gutter. The counter updates as you go, and when nothing is left it says No changes.

For an agent run's edits in the chat, « also accepts the agent's edit for those lines, and » puts the lines back the way they were before the run.

Accept all or reject all

Accept all keeps every change in the file, and Reject all reverts every change in the file. Both are in the header and act on the file you are looking at; pick another file on the side to go on.

Edit the file side

The right side is your file. Type in it to fix something while you review: the change list follows your edits, and they are saved when you switch files or close the viewer.

Smart merge for conflicted files

A file with a merge conflict (after git merge, git rebase or git cherry-pick) shows a merge icon in the file list and opens in the three-way view. Smart merge runs on its own when the file opens: every change that only one side made, or both sides made the same way, goes into the result. What is left are the real conflicts, where both sides changed the same lines differently. They are highlighted, and the header says 1 conflict · 2 auto-merged.

The three-way view: yours on the left, the result in the middle with the conflict highlighted, theirs on the right, and 1 conflict · 2 auto-merged in the headerThe three-way view: yours on the left, the result in the middle with the conflict highlighted, theirs on the right, and 1 conflict · 2 auto-merged in the header
The three-way view: yours on the left, the result in the middle with the conflict highlighted, theirs on the right, and 1 conflict · 2 auto-merged in the header

Same-line edits

Smart merge also looks inside a line both sides edited. It splits the line into tokens (names, numbers, strings, punctuation and spaces) and merges them: if you renamed total to count and they changed add(a, b) to add(a, c), the result is count = add(a, c). The same works for two different arguments, or one side adding a prefix and the other a suffix. A change both sides made the same way is taken once. When a chunk has a line added or removed, the lines are matched up first, and each edited line is merged on its own.

These lines are marked auto-resolved same-line in the result, with a wand in the gutter, and the header counts them: 1 conflict · 2 auto-merged (1 same-line). Hover the badge or the line to see why it was merged. », « and × still take a side or the base, and Smart merge brings the merged line back.

It stays a conflict when both sides changed the same token differently (for example MODE = "safe" and MODE = "slow"), or when both inserted different text at the same place.

The three-way view with count = add(a, c) in the result marked auto-resolved same-line, the MODE line still a conflict, and 1 conflict · 2 auto-merged (1 same-line) in the headerThe three-way view with count = add(a, c) in the result marked auto-resolved same-line, the MODE line still a conflict, and 1 conflict · 2 auto-merged (1 same-line) in the header
The three-way view with count = add(a, c) in the result marked auto-resolved same-line, the MODE line still a conflict, and 1 conflict · 2 auto-merged (1 same-line) in the header

The three-way view

The three panes scroll together:

PaneWhat it shows
LeftYours: your branch (for example main (yours, read-only))
MiddleResult: what will be written. You can type in it.
RightTheirs: the commit being merged in (MERGE_HEAD, or REBASE_HEAD during a rebase)
ActionWhat it does
» on the leftPuts your change into the result. On a conflict you can take both sides: the result gets yours, then theirs.
« on the rightPuts their change into the result.
×Ignores the change: the result keeps the base text there.
Smart mergeApplies every non-conflicting change again.
ResetGoes back to the base text.
Accept left / Accept rightTakes one whole side.
ApplyWrites the result, stages it and marks the file resolved. It is disabled until every conflict is resolved or ignored.

When every conflict is resolved, the header says All conflicts resolved. After Apply the file is a normal change again and shows in the two-way view.

Keyboard shortcuts

Every shortcut works while the viewer is open and is shown in the tooltip of its arrow or button. Every action is also in Find Action (⌘⇧A, Ctrl+Shift+A) under Diff Viewer.

ActionmacOSWindows and Linux
Next changeF7F7
Previous change⇧F7Shift+F7
Apply change («, or take theirs in three-way)⌘⌥⇧←Ctrl+Alt+Shift+←
Revert change (», or take yours in three-way)⌘⌥⇧→Ctrl+Alt+Shift+→
Accept all (Smart merge in three-way)⌘⇧EnterCtrl+Shift+Enter
Reject all (Reset in three-way)⌘⇧⌫Ctrl+Shift+Backspace
Ignore change (three-way)⌘⌥⇧⌫Ctrl+Alt+Shift+Backspace
CloseEscEsc
The tooltip of a >> arrow: Revert this change, with its shortcutThe tooltip of a >> arrow: Revert this change, with its shortcut
The tooltip of a >> arrow: Revert this change, with its shortcut

Settings

Open Settings › Tools › Agent review before commit, or set the key in your user settings or the project's .ingot/settings.json:

SettingDefaultWhat it does
ingot.diffViewer.autoMergetrueSmart merge conflicted files when they open in the three-way view. Turn it off to start from the base text.

From the terminal

The ingot CLI runs the same smart merge on three files, in scripts or as a git merge driver:

npx @ingotide/cli merge yours.ts base.ts theirs.ts                   # prints the result; exit 1 while conflicts are left
npx @ingotide/cli merge yours.ts base.ts theirs.ts --output yours.ts # write it in place
npx @ingotide/cli merge yours.ts base.ts theirs.ts --conflicts theirs --json
git config merge.ingot.driver "ingot merge %A %O %B --output %A"

Conflicts are left as diff3-style markers (<<<<<<<, |||||||, =======, >>>>>>>) unless --conflicts yours, theirs or both takes a side. Same-line edits are merged as in the viewer and counted as sameLine in --json; --line-only turns that off and treats any line both sides edited as a conflict, like git. Every option is on the CLI reference.