HydraGit Docs
v0.3.1

Sidebar — staging view

The activity-bar webview hydragit.sidebarView: a focused staging-and-commit surface. Changed files with status badges, real-index staging checkboxes, inline hunk staging, per-level discard, and a pinned commit area with Commit / Commit & Push.

Opening the sidebar

Entry points

  • Activity barClick the HydraGit hexagon; the sidebar view is the first item in the container.
  • Auto-refreshThe sidebar subscribes to a 3-second status poll, so the file list and counts update on their own.

What happens next

  1. On mount it sends status and renders the returned changed-file list.
  2. HydraStatusService pushes a fresh snapshot on every change via the statusUpdate message; the tree re-renders.
  3. The tree's two sections come straight from git's own index/worktree split — each file carries an indexStatus (staged side) and a workStatus (working-tree side), so a file edited after staging shows in both.

Changed-files tree FileTree

Staged and unstaged files in a collapsible folder tree, each with a status badge:

M modified · A added · D deleted · R renamed · U unmerged · C copied · T type-changed

  • Per-file checkbox — stage or unstage that single file (see real-index staging).
  • Click a file to open its diff.
  • Hover a row for an open-file pencil and a ↶ discard button (see discard).
  • Right-click a row for Show Diff · Open File · Copy Path · Discard Changes.
  • The chevron expands the file's hunks inline (see hunk staging).

Real-index staging stage unstage

The checkboxes drive git's real index, VS Code SCM–style: checking a file runs git add, unchecking runs git restore --staged (on an unborn branch, rm --cached). This is a change from the old behaviour, where staging was a webview-side list and git add only ran at commit time.

  • Stage, then keep editing — the frozen snapshot stays under Staged Changes while the new edits appear as a second row under Changes (git's MM state).
  • Commit takes the frozen snapshotcommit commits the index as it stands, not whatever the file looks like at commit time.
  • Staging is shared and durable — it's the real index, so it survives reloads and is visible to the terminal and other git tools.
  • Conflicted rows have no checkbox; the conflict banner owns their resolution.

Hunk staging diff.working hunk.stage

Stage part of a file, Sublime Merge–style. The chevron on any file row expands a compact unified diff inline, one bar per hunk:

  • In Changes, each hunk has Stage and ↶ Discard.
  • In Staged Changes, each hunk has Unstage.
  • Stage one hunk of a many-hunk file, commit it, leave the rest as working changes.

Under the hood each hunk carries git's verbatim patch text, round-tripped back through git apply --cached (or -R for unstage/discard) — so the patch is never reconstructed. A stale hunk (the index moved since the diff rendered) is git's own “does not apply” refusal, surfaced and re-synced rather than half-applied. Binary and untracked files have no hunks — use the whole-file checkbox. Hunk discard auto-snapshots like every discard.

Discard changes discard

Throw away local changes at any level of the tree, with a working-tree snapshot saved automatically first so every discard is recoverable.

  • File — the hover or the right-click Discard Changes.
  • Folder / section — the revealed on the folder row or the Staged Changes / Changes header.
  • Tracked files are restored from HEAD; untracked/added files are removed from disk (the confirm says so).
  • The confirm names the repo in multi-repo workspaces; conflicted files are refused, and bulk discards skip them.

Section headers SectionHeader

Collapsible headers with file counts. The master checkbox stages/unstages everything in the section; each header also reveals a ↶ discard-all on hover. Because the sections now come from the real index, a folder row is simply checked in Staged Changes and unchecked in Changes (no indeterminate state).

Multiple repositories RepoGroup

When the workspace has more than one repo, the sidebar stacks each as its own collapsible group — header, changed-files tree, and commit area per repo. Clicking a group's header focuses that repo, and the main panel follows. A single-repo workspace stays flat (no header). Full detail on the multi-repo page.

Commit area CommitArea

Pinned to the bottom: the message textarea, a branch chip showing the target, and the action buttons.

  • Commit — enabled only when something is staged and the message is non-empty; it commits the real index (no paths are re-staged at commit time).
  • Commit & Push — shown when the branch has an upstream and amend is off.
  • Amend last commit toggle — prefills HEAD's message; staging becomes optional. See amend.

Conflict banner ConflictBanner

While a merge/rebase/cherry-pick is paused, a banner replaces the normal commit flow with per-file resolve actions and Continue / Abort. Full detail on the conflict resolution page.