You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
File- and hunk-level staging before commit/PR #191
File- and hunk-level staging in diff review: stage individual files or hunks and commit only what is approved (docs).
Solenta today
Commit is all-or-nothing: the merge path "stages with add -A anyway" (electron/worktrees.js:193-194), and the behavior is literally tested as "commit stages everything" (electron/test/worktrees-commit.test.js:54).
Why it matters
Agents routinely mix a wanted change with drive-by edits; without selective staging the only recourse is an external git tool, breaking the "review and land without leaving Solenta" loop.
Fix direction
Checkboxes per file in the diff view (hunk-level as a second step); commit/merge stages only the selected paths.
Codex's diff pane ships this as chunk-level staging and revert, sitting next to native commit/push/PR (26.415 writeup): "diff display with inline commenting, chunk-level staging/reverting, and native commit/push/PR creation."
The revert half is the piece missing from this issue and it is the more valuable one for agent work: the common case is not "commit half of this", it is "keep the fix, throw away the four files it touched on the way there." Per-hunk revert is also a much smaller blast radius than #149's checkpoint restore and needs no checkpoint at all.
Pairs with #363 (commit-push-PR chain) — staging selection is the input to that chain.
File-level staging is in this worktree (hunk-level left as the follow-up the issue already named).
Git pane: a checkbox per file, default all staged, plus a stage-all control. Commit sends only the checked paths. Unchecking everything disables Commit. The label becomes "Commit N files" when it is a subset.
git.commit / git.mergeWorktree: optional paths. Omitted still add -A (orchestration and a Git-tab Merge that never opened the pane). A path list stages those files only. Merge then refuses if the worktree is still dirty, so squash-and-delete cannot eat unselected files.
Hunk-level git add -p is not in this change. "Mark reviewed" on a hunk remains the review-itinerary flag, not a stage.
Moved back to plan:todo (2026-10-03 board cleanup).
File-level staging is on main:
A per-file checkbox, stage-all, and an "N/M staged" count (src/components/ThreadView.tsx:3877, 4188-4209).
Commit sends only the selected paths through git commit -- paths (electron/worktrees.js:1305-1313).
Per-file revert via git.revertFile (src/useCoder.ts:3138-3144).
Still missing: hunk-level staging (git add -p / apply --cached) and per-hunk revert, which the comments above call the more valuable part. Nothing hunk-related exists yet in worktrees.js, preload or the IPC channels.
Hunk-level staging and per-hunk discard are in commit ee428d4 on branch coder/file-and-hunk-level-staging-before-commi-8bf7ba. Not merged yet.
Git pane: each hunk has a stage checkbox and a ↩ discard button. Unticking some hunks shows the file checkbox as mixed (–). Unticking every hunk unstages the file. The file checkbox and stage-all stay all-or-nothing. Hunk controls are hidden when the diff is truncated.
Backend:
git.commit accepts patches: [{path, patch}] for partially staged files. The commit is built in a throwaway GIT_INDEX_FILE seeded from HEAD, so the user's real index and anything already staged elsewhere are untouched. Afterwards the committed paths are reset to the new HEAD, the same as commit --only.
New git.revertHunk runs git apply -R on one hunk against the worktree. Both apply paths use --include=<path> and --recount.
Merge stays file-level. A partially staged file is left out of the merge path list, so merge refuses on the leftover instead of squashing hunks the user unticked.
Known gaps:
Hunk staging and discard don't work on WSL repos: the temp files go in os.tmpdir(), which git inside WSL can't see.
Untracked files have no hunks in git diff HEAD, so they stay file-level only.
Tests: electron worktrees and IPC tests 108/108; renderer 2695/2695 (run at concurrency 4, because the machine's load average was about 229 and files hit the default 20s timeout); typecheck, IPC sync check and vite build pass. The renderer patch was also checked end to end against real git: discard the middle hunk, commit the last one, and the first stays in the worktree.
Activity
currentbits commentedon Aug 19, 2026
Codex's diff pane ships this as chunk-level staging and revert, sitting next to native commit/push/PR (26.415 writeup): "diff display with inline commenting, chunk-level staging/reverting, and native commit/push/PR creation."
The revert half is the piece missing from this issue and it is the more valuable one for agent work: the common case is not "commit half of this", it is "keep the fix, throw away the four files it touched on the way there." Per-hunk revert is also a much smaller blast radius than #149's checkpoint restore and needs no checkpoint at all.
Pairs with #363 (commit-push-PR chain) — staging selection is the input to that chain.
currentbits commentedon Aug 23, 2026
File-level staging is in this worktree (hunk-level left as the follow-up the issue already named).
Git pane: a checkbox per file, default all staged, plus a stage-all control. Commit sends only the checked paths. Unchecking everything disables Commit. The label becomes "Commit N files" when it is a subset.
git.commit / git.mergeWorktree: optional
paths. Omitted stilladd -A(orchestration and a Git-tab Merge that never opened the pane). A path list stages those files only. Merge then refuses if the worktree is still dirty, so squash-and-delete cannot eat unselected files.Hunk-level
git add -pis not in this change. "Mark reviewed" on a hunk remains the review-itinerary flag, not a stage.currentbits commentedon Oct 3, 2026
Moved back to plan:todo (2026-10-03 board cleanup).
File-level staging is on main:
git commit -- paths(electron/worktrees.js:1305-1313).git.revertFile(src/useCoder.ts:3138-3144).Still missing: hunk-level staging (
git add -p/ apply --cached) and per-hunk revert, which the comments above call the more valuable part. Nothing hunk-related exists yet in worktrees.js, preload or the IPC channels.currentbits commentedon Oct 10, 2026
Hunk-level staging and per-hunk discard are in commit ee428d4 on branch
coder/file-and-hunk-level-staging-before-commi-8bf7ba. Not merged yet.Git pane: each hunk has a stage checkbox and a ↩ discard button. Unticking some hunks shows the file checkbox as mixed (–). Unticking every hunk unstages the file. The file checkbox and stage-all stay all-or-nothing. Hunk controls are hidden when the diff is truncated.
Backend:
git.commitacceptspatches: [{path, patch}]for partially staged files. The commit is built in a throwawayGIT_INDEX_FILEseeded from HEAD, so the user's real index and anything already staged elsewhere are untouched. Afterwards the committed paths are reset to the new HEAD, the same ascommit --only.git.revertHunkrunsgit apply -Ron one hunk against the worktree. Both apply paths use--include=<path>and--recount.Merge stays file-level. A partially staged file is left out of the merge path list, so merge refuses on the leftover instead of squashing hunks the user unticked.
Known gaps:
os.tmpdir(), which git inside WSL can't see.git diff HEAD, so they stay file-level only.Tests: electron worktrees and IPC tests 108/108; renderer 2695/2695 (run at concurrency 4, because the machine's load average was about 229 and files hit the default 20s timeout); typecheck, IPC sync check and vite build pass. The renderer patch was also checked end to end against real git: discard the middle hunk, commit the last one, and the first stays in the worktree.
Hunk-level staging and per-hunk discard in the Git pane (#191)
Hunk-level staging and per-hunk discard in the Git pane (#191) (#1576)
currentbits commentedon Oct 10, 2026
Landed from Solenta thread "File- and hunk-level staging before commit/PR" (PR #1576). Closed on merge.
Hunk-level staging and per-hunk discard in the Git pane (#191)