HydraGit Docs
v0.3.1

Working-tree snapshots

A time machine for uncommitted work. Before every risky operation HydraGit captures the full working tree — staged, unstaged and untracked files alike — without touching it. Botch a merge, reset the wrong thing, lose a new file to a stray clean: the state from right before is one click away.

Auto-capture snapshot.save

When snapshots are taken

  1. Automatically, right before: merge rebase (all variants) reset pull checkout cherry-pick revert undo stash pop/apply discard hunk discard — and before a snapshot restore itself.
  2. Inside the repo's operation lock, so the captured state is exactly what the operation saw.
  3. A clean tree skips silently — nothing at risk, nothing saved. Capture failures never block the operation (best-effort by design).
iUnlike the reflog (which tracks committed history) and the auto-stash net (tracked files on hard reset), snapshots cover the whole tree — including brand-new untracked files, the exact thing a stray git clean -fd eats.

Browse & diff snapshot.list

Entry point

  • Branch paneSnapshots section (below Worktrees) — label, age, hover actions.
  1. Each row shows the trigger label (e.g. before reset), the branch it was taken on (recorded in the snapshot commit; older snapshots render without it), and a real date (Today 3:00 pm / Jun 10) instead of a bare relative age.
  2. Click a snapshot to see what it captured — the dirty files at the moment it was taken (exactly what ↺ Restore writes back), in the detail pane, titled with the label, branch, and capture time. (Snapshot commits are on no branch, so they aren't looked up in the log.)

Restore snapshot.restore

Entry point

  • Snapshot rowHover → (Restore working tree from this snapshot).
  1. After a confirm, the snapshot's content is checked back out over the working tree (git restore --source).
  2. Files that exist only in the snapshot come back; files created after it are left alone; current edits to snapshotted files are overwritten.
  3. Restore is itself undoable: a snapshot of the pre-restore state is taken first.

Delete & pruning snapshot.drop

  1. Hover → × deletes one snapshot (confirm required; the ref is removed, objects become GC-eligible).
  2. Auto-pruning keeps the newest 20 — old snapshots age out on their own, the section never becomes a junk drawer.

How it works

  1. A throwaway index is built from HEAD, the full working tree is layered on with add -A (.gitignore respected), then write-tree + commit-tree produce an ordinary commit — the real index, the stash list and the working tree are never touched.
  2. The commit is pinned under refs/hydragit/snapshots/<timestamp>, so GC can't collect it and git stash list stays clean.
  3. If the resulting tree equals HEAD's, nothing is recorded.
iStaging state is not preserved — a snapshot records content, which is what "never lose work" needs. Deliberately not git stash create: that ignores untracked files.