Status & Staging (s*, a*) โ
Status and staging commands in Hug provide clear views of your repo state and easy ways to stage/unstage changes. Prefixed with s for "status" and a for "add/stage."
These enhance Git's status and add with colored summaries, patches, and smart defaults.
Mnemonic Legend
- Bold letters in command names highlight the initials that build each alias (for example,
hug slโ Status + List). - The Memory Hook column repeats that breakdown so you can build muscle memory quickly.
- Safety icons used below: โ safe/preview-only ยท โ ๏ธ requires caution or forces data removal ยท ๐ confirms before running.
On This Page โ
- Quick Reference
- Status Commands (s*)
- Visual diff (hug dd)
- Staging Commands (a*)
- Unstaging
- Stash Commands (s* overlap)
- Scenarios
- Tips
- Coverage Checklist
Command Family Map
Looking for other families? Try HEAD Operations (h*) for resets, Working Directory (w*) for cleanups, or Logging (l*) to inspect history before staging.
Quick Reference โ
| Command | Memory Hook | Summary |
|---|---|---|
hug s | Status snapshot | Colored summary of staged/unstaged changes; supports query flags for scripting |
hug sl | Status + List | Status with listed tracked changes |
hug sla | Status + List All | Status including untracked files |
hug ss | Status + Staged | Show staged diff |
hug su | Status + Unstaged | Show unstaged diff |
hug sw | Status + Working | Combined staged and unstaged diff |
hug dd | Dir-Diff (visual) | Visual side-by-side difftool: dd s/u/w โ see Visual diff |
hug a | Add tracked | Stage tracked changes |
hug aa | Add All | Stage tracked and untracked changes |
hug us | UnStage | Unstage specific files |
hug usa | UnStage All | Unstage everything |
Status Commands (s*) โ
Basic Status โ
hug s: Status snapshot- Description: Quick colored summary of staged/unstaged changes (no untracked files). Also supports query flags for scriptable field extraction.
- Example:
hug s(always safe, no args),hug s -r(remote URL),hug s -b -r -u(branch, remote, upstream). - Safety: โ Read-only overview; nothing is modified.
Query Flags
When any query flag is passed,
hug senters query mode: individual fields are printed to stdout (one per line by default, NUL-separated with-z), with no colored output or chatter on stderr. Computation is lazy โ only requested fields incur git operations.Flag Field Notes -b, --branchCurrent branch name Empty if detached HEAD -r, --remoteURL of tracking remote Empty if no upstream -u, --upstreamUpstream tracking branch Empty if none -H, --hashFull commit hash HEAD -s, --short-hashShort commit hash HEAD -A, --aheadCommits ahead of upstream Count -B, --behindCommits behind upstream Count -C, --countsCombined ahead/behind ahead behind-I, --ignoredIgnored file count -K, --untrackedUntracked file count -S, --stagedStaged file count -U, --unstagedUnstaged file count --ballState emoji Encodes repo state -z, --nullNUL separator Use with other query flags --jsonFull JSON output Mutually exclusive with query flags Query flags are mutually exclusive with
--json. Combine freely:hug s -r # URL of tracking remote hug s -b -r -u # Branch, remote URL, upstream (tab-separated) hug s -z -b -H | xargs -0 # NUL-separated for unusual nameshug sl: Status + List- Description: Status with a list of uncommitted tracked files (mirrors plain
git status). - Example:
hug sl - Safety: โ Read-only.
Visual Examples: hug sl in Different States
Clean Working Directory:

With Unstaged Changes:

With Staged Changes:
Mixed (Staged + Unstaged):

- Description: Status with a list of uncommitted tracked files (mirrors plain
hug sla: Status + List All- Description: Full status including untracked files so you can see new additions.
- Example:
hug sla - Safety: โ Read-only (includes untracked context only).
hug sli: Status + List Ignored- Description: Status plus ignored and untracked files to surface items in
.gitignore. - Example:
hug sli - Safety: โ Read-only (great for spotting generated artifacts).
- Description: Status plus ignored and untracked files to surface items in
Related: After inspecting status, jump to Detailed Patches for inline diffs or hop over to Working Directory (w*) to clean up files you find.
Scenario
Task: Sanity-check your working tree before pushing.
Flow: Run hug sl for a tracked summary, then hug sla if you need to confirm no new files are lingering.
Detailed Patches โ
Show diffs inline for better inspection.
hug ss [file]: Status + Staged diff- Description: Status + staged changes patch (for a file or all files). By default shows both patch and statistics. Use
--statfor statistics only or--no-statsfor patch only. Use--to interactively select from staged files. - Example:
hug ss # Show all staged changes (patch + stats) hug ss --stat # Show only staged statistics hug ss --no-stats # Show only staged patch (no statistics) hug ss src/app.js # Show staged changes for specific file hug ss -- # Interactive file selection from staged files - Safety: โ Read-only diff preview.
- Description: Status + staged changes patch (for a file or all files). By default shows both patch and statistics. Use
hug su [file]: Status + Unstaged diff- Description: Status + unstaged changes patch. By default shows both patch and statistics. Use
--statfor statistics only or--no-statsfor patch only. Use--to interactively select from unstaged files. - Example:
hug su # Show all unstaged changes (patch + stats) hug su --stat # Show only unstaged statistics hug su file.txt # Show unstaged changes for specific file hug su --stat file.txt # Show stats for specific file only hug su -- # Interactive file selection from unstaged files - Safety: โ Read-only diff preview.
- Description: Status + unstaged changes patch. By default shows both patch and statistics. Use
hug sw [file]: Status + Working directory diff- Description: Status + working directory patch (staged + unstaged). By default shows both patch and statistics. Use
--statfor statistics only. Use--to interactively select from changed files. - Example:
hug sw # Show all working directory changes (patch + stats) hug sw --stat # Show only statistics (no patches) hug sw . # Show all changes in current directory hug sw -- # Interactive file selection from changed files - Safety: โ Read-only diff preview.
- Description: Status + working directory patch (staged + unstaged). By default shows both patch and statistics. Use
hug sx: Status eXpress- Description: Working tree summary with unstaged focus. Options:
--no-color. - Example:
hug sx - Safety: โ Read-only summary (fast overview).
- Description: Working tree summary with unstaged focus. Options:
Related: Compare against recent commits with
hug lporhug lbefore deciding whether to amend or discard changes.
Scenario
Task: Review your commit before amending.
Flow: Run hug ss to verify staged fixes, then hug su to ensure no leftovers remain before hug caa.
Visual diff: hug dd โ
hug dd opens a visual side-by-side difftool (e.g. kitty diff) instead of printing a text patch. It's the visual counterpart to ss/su/sw, with matching s/u/w subcommands.
| Command | Shows | Compares |
|---|---|---|
hug dd s | Staged | index vs HEAD |
hug dd u | Unstaged | worktree vs index |
hug dd w (or bare hug dd) | All uncommitted (net) | worktree vs HEAD |
hug dd <ref|range> | A commit / range | as given (e.g. hug dd HEAD~3) |
hug dd s # staged changes, visual
hug dd u # unstaged changes, visual
hug dd w # ALL uncommitted changes (same as bare `hug dd`)
hug dd HEAD~3 # a commit / range
hug dd w -- src/ # scope to a path
hug dd -- # pick files interactively, then one difftool windowNet view vs the two-section split โ
Git holds your work as a chain of three snapshots:
HEAD (last commit) โ index (staging area) โ working tree (files on disk)hug sw (text) shows this chain as two diffs: a staged section (HEAD โ index) and an unstaged section (index โ worktree). hug dd w shows only the endpoints as a single diff (HEAD โ worktree) โ it must, because git difftool --dir-diff opens the tool once on two snapshots and can't render two sections without launching it twice (poor UX).
Collapsing the middle means the two steps can cancel out. Example โ config.txt is port = 80 at HEAD:
- Change it to
port = 8080and stage it (index =8080). - Then edit the working file back to
port = 80.
| View | Shows |
|---|---|
hug sw | two changes: staged 80 โ 8080, unstaged 8080 โ 80 |
hug dd w | nothing โ HEAD (80) and worktree (80) are identical โ No changes. |
This is intentional, not a bug. dd w answers "what does my tree look like vs my last commit?" (the common case). When you need the exact staged-vs-unstaged split, use hug dd s + hug dd u (each diffs one link of the chain) or the text view hug sw.
TIP
hug dd needs a difftool configured in git (diff.tool + difftool.<name>.cmd). It is interactive/TTY-only and refuses to run in a pipe โ for pipe-safe patch output use hug ss / hug su / hug sw.
Staging Commands (a*) โ
hug a [files...]: Add tracked- Description: Stage tracked changes (or specific files if provided). If no args, stages updates only. Use
--to trigger interactive file selection UI. - Example:
hug a # Stage all tracked updates hug a src/ # Stage directory, including non-tracked files hug a -- # Interactive file selection (requires gum) - Safety: โ
Safe staging (reversible with
hug us).
- Description: Stage tracked changes (or specific files if provided). If no args, stages updates only. Use
hug aa: Add All- Description: Stage everything (tracked + untracked + deletions).
- Example:
hug aa(use carefully). - Safety: โ ๏ธ Sweeps all changes - run
hug slafirst to confirm what's included.
hug ai: Add + Interactive- Description: Interactive add menu (Git's
-i). - Example:
hug ai - Safety: โ Interactive preview before staging.
- Description: Interactive add menu (Git's
hug ap: Add + Patch- Description: Interactive patch staging (hunk-by-hunk).
- Example:
hug ap - Safety: โ Interactive hunk selection.
Related: Once staged, continue with Commits (c*) like
hug corhug caato record the snapshot.
Scenario
Task: Stage only your lint fixes.
Flow: Run hug ap to choose specific hunks, then hug ss to confirm before committing with hug c.
Unstaging โ
hug us <files...>: UnStage specifics- Description: Unstage specific files.
- Example:
hug us file.js - Safety: โ Only affects the index; your working tree stays untouched.
hug usa: UnStage All- Description: Unstage all files.
- Example:
hug usa - Safety: โ ๏ธ Clears the entire staging area - review with
hug slafterward.
hug untrack <files...>- Description: Stop tracking files but keep them locally (e.g., for secrets).
- Example:
hug untrack .env - Safety: โ ๏ธ Removes files from version control; make sure
.gitignorecovers them to prevent re-adding.
Related: If you need to toss changes entirely, jump to
hug w discardorhug w wipfor safe checkpoints.
Scenario
Task: You staged a compiled artifact by mistake.
Flow: Run hug us dist/app.js, add it to .gitignore, then hug untrack dist/ so it stays local only.
Scenarios โ
Scenario: Patch-and-Push
Goal: Ship a small change without noise.
hug slto verify tracked files.hug apto stage only the relevant hunk.hug ssto double-check the staged diff, thenhug c "Describe change".hug bpushto publish.
Scenario: Recover from Experimental Edits
Goal: Restore a clean working tree after a spike.
hug slato spot all touched files.hug w wip "Spike backup"for a safety net.hug w discard-allfor tracked changes, followed byhug w purgefor generated files.- Finish with
hug sto confirm you're clean.
Tips โ
- Use
hug s/hug slas your heartbeat commands; rerun them after every change to stay oriented. - When staging aggressively with
hug aa, follow withhug ssandhug suto ensure nothing surprising slips in. - Combine
hug slwithhug llffrom Logging (l*) to tie current work back to file history. - Share concise stand-up updates by pasting
hug sxoutput or attaching diffs fromhug ss.