Skip to content

Logging (l*) ​

Logging commands in Hug provide powerful ways to view, search, and inspect commit history. Prefixed with l for "log," they enhance Git's log command with intuitive searches by message, code changes, authors, dates, and file-specific histories. File-focused commands (llf*) handle renames via --follow and support limiting to recent commits (e.g., -1 for the most recent).

Quick Reference ​

CommandMemory HookSummary
hug lLogOneline history with graph and decorations
hug luLog after UpstreamLog commits after the last Upstream commit
hug laLog AllOneline log across all branches
hug llLog LongDetailed log with full messages
hug lluLog Long after UpstreamLog commits after the last Upstream commit
hug llaLog Long AllDetailed log across all branches
hug lpLog PatchLog with diffs for each commit
hug loLog OutgoingQuiet preview of commits not yet on upstream
hug lolLog Outgoing LongFull preview of commits not yet on upstream
hug lfLog message FilterSearch commit messages
hug lcLog Code searchSearch diffs for exact term
hug lcrLog Code RegexSearch diffs with regex
hug lauLog AuthorFilter log by author
hug ldLog DateLog commits within a date range
hug llfLog Lookup FileFile history following renames
hug llfsLog Lookup File StatsFile history with change statistics
hug llfpLog Lookup File PatchFile history with full patches

Basic Logging ​

  • hug l [options]

    • Description: One-line log with graph visualization and branch decorations for a concise history overview.
    • Example:
      shell
      hug l              # Current branch history
    • Safety: Read-only; no repo changes.
    • hug l example
  • hug la [options]

    • Description: One-line log with graph visualization and branch decorations for a concise history overview for ALL branches.
    • Example:
      shell
      hug la              # branch history for ALL branches
    • Safety: Read-only; no repo changes.
    • hug la example
  • hug ll [options]

    • Description: Detailed log with graph, short date, author, decorations, and full commit message.
    • Example:
      shell
      hug ll             # Current branch detailed history
    • Safety: Read-only.
    • hug ll example
  • hug lla [options]

    • Description: Detailed log with graph, short date, author, decorations, and full commit message for ALL branches.
    • Example:
      shell
      hug lla             # Detailed history for ALL branches
    • Safety: Read-only.
    • hug lla example
  • hug lp [options]

    • Description: Detailed log including patches/diffs for each commit.
    • Example:
      shell
      hug lp             # Patches for current branch
      hug lp -3          # Last 3 commits with patches
    • Safety: Read-only.
    • hug lp example

Search by Commit Message ​

  • hug lf <search-term> [-i] [-p] [--all] [-- [<file>]]
    • Description: Search commit history by grep on commit messages. Use -- as the last argument for interactive file selection to restrict the search.
    • Options:
      • -i: Ignore case.
      • -p: Include patches in results.
      • --all: Search all branches.
      • -- <file>: Restrict search to specific file.
      • -- (last arg): Restrict with interactive file selection.
    • Usage:
      shell
      hug lf "fix bug"           # Search for "fix bug"
      hug lf "fix bug" -i        # Case-insensitive search
      hug lf "fix bug" --all     # Search all branches
      hug lf "fix bug" -- file.js  # Restrict to specific file
      hug lf "fix bug" --        # Interactive file selection
    • Safety: Read-only.
    • hug lf example

Search by Code Changes ​

  • hug lc <search-term> [-i] [-p] [--all] [-- [<file>]]

    • Description: Search commits where the diff (code changes) contains the term (Git's pickaxe search). Use -- as the last argument for interactive file selection to restrict the search.
    • Options:
      • -i: Ignore case.
      • -p: Show patches.
      • --all: All branches.
      • -- <file>: Restrict search to specific file.
      • -- (last arg): Restrict with interactive file selection.
    • Example:
      shell
      hug lc "getUserById"                  # Search code changes
      hug lc "getUserById" -- src/users.js  # Restrict to specific file
      hug lc "getUserById" --               # Interactive file selection
    • Safety: Read-only.
    • hug lc example
  • hug lcr <regex> [-i] [-p] [--all] [-- [<file>]]

    • Description: Search commits where the diff matches a regex (more flexible than lc). Use -- as the last argument for interactive file selection to restrict the search.
    • Options: Same as lc.
    • Example:
      shell
      hug lcr "TODO:"              # Regex search
      hug lcr "TODO:" --all        # Search across all branches
      hug lcr "TODO:" --           # Interactive file selection
    • Safety: Read-only.

Search by Author and Date ​

  • hug lau <author> [options]

    • Description: Filter log to commits by a specific author.
    • Example:
      shell
      hug lau "John Doe"       # Author's commits
      hug lau "John Doe" -5    # Last 5 by author
    • Safety: Read-only.
    • hug lau example
  • hug ld <since-date> [<until-date>]

    • Description: Log commits within a date range (until defaults to now).
    • Example:
      shell
      hug ld "2023-01-01"      # Since date
      hug ld "2023-01-01" "2023-12-31"  # Date range
    • Safety: Read-only.
    • hug ld example

File Inspection (llf*) ​

These commands show the history of changes to a specific file, following renames. Use -N to limit to the last N commits (e.g., -1 for most recent). Combine with log options like --stat or -p. When no file is provided, shows an interactive file selection UI (requires gum).

  • hug llf [<file>] [-N] [log options]

    • Description: Log commits that modified a file (handles renames). Ideal for finding the most recent change to a file. When no file is provided, shows interactive file selection.
    • Example:
      shell
      hug llf                      # Interactive file selection
      hug llf file.txt -1          # Most recent commit touching file
      hug llf file.txt -2 --stat   # Last 2 commits with stats
    • Safety: Read-only.
    • hug llf example
  • hug llfs [<file>] [-N] [log options]

    • Description: File history with change statistics (insertions/deletions). When no file is provided, shows interactive file selection.
    • Example:
      shell
      hug llfs                 # Interactive file selection
      hug llfs file.txt -1     # Stats for most recent change
    • Safety: Read-only.
  • hug llfp [<file>] [-N] [log options]

    • Description: File history including full patches/diffs. When no file is provided, shows interactive file selection.
    • Example:
      shell
      hug llfp                 # Interactive file selection
      hug llfp file.txt -1     # Patch of most recent change
    • Safety: Read-only.

Tips ​

  • Most recent commit touching a file: hug llf <file> -1 (handles renames with --follow).
  • Last N commits for a file: hug llf <file> -N (e.g., -2 for last 2). Use hug llfs <file> -1 for stats or hug llfp <file> -1 for patches.
  • Search history by file changes: Combine with lf or lc for message/code searches restricted to file touches, e.g., hug lc "TODO" -- file.txt.
  • Pipe to pager for long outputs: hug ll | less.
  • For line-level inspection (blame), see File Inspection like hug fblame <file>.
  • Use hug la or hug ll --all to search across branches.
  • Status as a Final Check: Several preview commands, including hug lo and hug lol, conclude with the output of hug s. This provides a consistent, final overview of your working directory before you decide to act.

Upstream Sync & Pre-push Checks (lo*) ​

These commands help you review what will be pushed to the remote (upstream) branch before you actually push. They are essential for a safe, clean workflow. Run them before hug bpush.

  • hug lo

    • Description: A quieter preview of local commits that are not yet on the upstream branch. It shows the essential safety information (git cherry -v) followed by the output of hug s for a final check, but skips the verbose list of outgoing commits. Ideal for a quick check.
    • Example:
      shell
      hug lo
    • Safety: Read-only. Exits with an error if the current branch has no configured upstream.
    • hug lo example
  • hug lol

    • Description: A comprehensive preview of all local commits that are not yet on the upstream branch. This is the ideal command to run before pushing. It shows:
      1. A diffstat of changes.
      2. A detailed list of outgoing commits.
      3. The exact unique commits that will be pushed (git cherry -v).
      4. The current repo status (the full output of hug s).
    • Example:
      shell
      hug lol
    • Safety: Read-only. Exits with an error if the current branch has no configured upstream.
    • hug lol example
  • hug log-outgoing

    • Description: The underlying script for hug lo and hug lol. You can call it directly for more control.
    • Options:
      • --fetch: Fetches the latest changes from the remote before performing the check, ensuring the comparison is up-to-date. Usage: hug log-outgoing --fetch
      • --quiet: Runs in quiet mode, identical to hug lo. Usage: hug log-outgoing --quiet
      • --help: Shows detailed help information.
    • Example:
      shell
      hug log-outgoing --fetch

Tip: Use hug lo for a quick check or hug lol for a full review. Once you're confident, use hug bpush to push them safely.

Pair logging with Status & Staging to inspect changes, or HEAD Operations to undo based on history.

Released under the Apache 2.0 License.