Skip to main content

Review tree and diffs

This page is the change tree, per-file diffs, and the selective commit and discard routes for a workspace worktree.

  1. GET .../git/changes

    Returns the uncommitted changes as a directory tree with per-file status, the live branch name, local and remote-tracking branch names, upstream, and ahead/behind counts.

  2. GET .../git/head

    Returns the live branch, local and remote-tracking branches, upstream, ahead/behind, and HEAD commit without the change tree.

  3. GET .../git/file?path=

    Returns one file's diff, including untracked files.

  4. POST .../git/commit

    Stages and commits only the requested paths with the supplied message and returns the new commit.

  5. POST .../git/discard

    Restores selected tracked files from HEAD and deletes selected untracked files.

Commit uses git commit --only after staging the selected files that still exist. New files that vanished after they were staged are unstaged instead of failing the whole commit. Because the commit passes explicit pathspecs, changes to files the caller did not select stay in the worktree. Missing Git identity, an in-progress merge, and other Git failures return structured problem details rather than raw Git stderr.

Where it differs

Desktop

Desktop owns selection propagation between directory and file rows. Directory chevrons collapse nested rows in client state; a collapsed directory checkbox still selects every file beneath it. Selecting a file name opens its diff in a modal. The panel reloads whenever the selected workspace changes, after a successful commit or discard, and on a short poll while it is open. The same refresh requests the commit queue and displays ordered proposal entries. Desktop treats the returned generation, ancestry, and managed-worktree path as authoritative and does not reconstruct queue state from the working tree.

Mobile

Mobile src/features/git/ owns the Git overview tab, Review page, History page, and the workspace branch picker. Tree flattening, directory/file selection, collapse visibility, selected-file counts, stale-tree signatures, branch-picker search, outside-press dismiss, and log-lane layout stay pure functions in providers/ so they are covered by node tests without a renderer. The Git tab overview lists changes and commits from the same tree; it does not have a Review button. History is a top action next to Push. Polling does not silently replace a visualized tree whose file set or statuses differ from the Server; Reload applies the current tree. The Review page displays Server-owned proposal queue messages, generation, and verification states; Mobile never derives ancestry or readiness locally.