Welcome to Hug Documentation ​
Hug is a CLI tool to streamline development. It provides a humane, intuitive interface for Git and Mercurial, transforming complex commands into a predictable, unified language that keeps you focused on coding.
Key features:
- Intuitive Commands: Shorter for common/safe ops, longer for powerful ones (e.g.,
hug bto switch branches). - Safety Built-In: Previews, dry-runs, and confirmations for destructive actions.
- Discoverability: Grouped by prefix (e.g.,
h*for HEAD,w*for working directory). - Multi-VCS Support: Full support for both Git and Mercurial with automatic repository detection.
New to Hug? ​
👉 Start here: Getting Started Guide - Learn the essentials in 15 minutes
Learning Path
- Getting Started - Core concepts and your first workflow
- Workflows Guide - Advanced patterns and real-world scenarios
- Command Map - Complete command reference
- Cheat Sheet - Quick syntax lookup
Daily Users ​
Quick reference: Cheat Sheet - Common commands and hidden gems
Scenario-based: Workflows Guide - Investigation patterns, commit management, and recipes
Command Reference ​
Start with the Command Map for a quick overview of all families, or the Cheat Sheet for daily workflows.
Dive into detailed guides for command groups:
- HEAD Operations (h*): Undo and rewind commits
- Working Directory (w*): Clean up changes
- Status & Staging (s*, a*): View and stage files
- Branching (b*): Switch, list, and manage branches
- Commits (c*): Create and amend commits
- Logging (l*): Search and view history
- File Inspection (f*): Analyze file authorship and history
- Tagging (t*): Manage tags for releases
- Merge (m*): Integrate branches
- Rebase (r*): Edit history
- WIP Workflow (w*): Park, resume, and unpark temp work
Tips for Common Queries ​
- Most recent commit touching a file: Use
hug llf <file> -1to get the latest commit modifying a specific file (handles renames with--follow). For multiple files, run separately and compare timestamps, or usehug llf file1 -1andhug llf file2 -1. - Last N commits for a file:
hug llf <file> -N(e.g.,-2for last 2). Usehug llfp <file> -1for patches orhug llfs <file> -1for changes. - Search history by file changes: Combine with
lforlcfor message/code searches restricted to file touches.