Hug Workflow
Hug is a complete Git replacement with enhanced UX and safety features.
Hug accepts existing git commands as well.
CRUCIAL: When you want to run a git command, ALWAYS translate it to a hug equivalent instead.
Critical Safety Rules
Before EVERY commit, ALWAYS:
- Run
hug sla- See ALL uncommitted files (staged, unstaged, untracked) - Stage only intended files (see Staging Decision Tree below)
CRITICAL for hug cm (amend):
hug cm -m 'msg'adds ANY staged files to the commit- ALWAYS run
hug slsfirst to list staged files - Use
hug usato unstage everything if you want message-only amend
Handling commit messages
Simple single-line (use -m):
hug c -m "Fix typo in README"
Multi-line from LLM (use -F - with heredoc):
hug c -F - <<'EOF'
feat: add feature
WHY: Users need this feature
WHAT: Implementation details
IMPACT: Benefits
EOF
Note: This avoids the complex pattern hug c -m "$(cat <<'EOF'...EOF)" while keeping natural multi-line formatting.
Staging Decision Tree
Start: hug sla
│
├─ Need to stage files?
│ ├─ Keep some unstaged? → hug a <file1> <file2> ... (selective)
│ └─ Stage ALL tracked? → hug a (no args, tracked files only)
│ └─ Stage untracked too? → hug a <file1> <file2> ... (explicit form)
│
├─ Verify: hug sls (list staged files only)
│
└─ Commit with `hug c` (supports `-m` for single-line or `-F - <<'EOF'..EOF` for multi-line)
RULE OF THUMB: If you didn't intentionally create/modify the file as part of your current task, DON'T stage it!
NEVER stage: Session artifacts like .claude/settings.local.json
Mapping: High-level intentions to Hug Commands
- To understand both which files were staged and what changes they contained so I can write an accurate commit message.
hug ss
Common Workflows
Commit Changes
hug sla # List S:*, U:*, untrcK files
hug a <files> # Stage specific files
hug sls # List S:* files
hug c -m 'message' # Commit
Inspect Repository State
hug sla # List staged, unstaged, untracked files
hug sls # List staged files only
hug sh # Last commit details, including list of files
hug llu # Outgoing commits (what would be pushed)
Search History
hug lf "term" -i --all # Search commit messages
hug lc "code" --all # Search code changes
hug ll # Log with file stats
Fix Last Commit
Change message ONLY:
hug sls # CRITICAL: Verify NO files are staged
hug cm -m 'new message' # Amends message only (keeps files intact)
Change message OR add files:
hug sla # Check which files to add
hug a <files> # Add files to stage
hug cm -m 'message' # Amends (message + staged files)
Remove files from commit:
hug back 1 # Go back, keeping changes staged
hug sls # List staged files
hug us <files> # Unstage unwanted files
hug c -m 'original message' # Re-commit
Key git -> hug Commands Mapping
ALWAYS use the Hug command that corresponds to the git command you're trying to run: | Git | Hug | Description | |----------------------------------|--------|----------------------------------------------------| | git diff --cached | hug ss | Show staged changes then file stats | | git diff --cached --stat --patch | hug ss | Show staged changes then file stats | | git diff --stat --patch | hug su | Show unstaged changes then file stats | | git diff HEAD --stat --patch | hug sw | Show all working directory changes then file stats |
Key Commands Reference
Status & Inspection:
hug sl- List staged (S:) and unstaged (U:) files, with statshug sls- List staged files onlyhug sla- List staged (S:), unstaged (U:) and untracked (untrcK) fileshug sh- Last commit with full message and diff statshug shp- Same ashug sh+ diffhug llu- Outgoing commitshug lol- Outgoing commits with file stats
Branch Operations:
hug b <branch>- Switch branchhug bc <name>- Create and switchhug bpush- Push current branchhug bpull- Pull (fast-forward only, safe)
Working Directory:
hug discard --force <file>- Discard unstaged changeshug discard-all --force- Discard all unstagedhug get <file> <commit>- Restore file from commit