Syntax
Description
The--status flag displays comprehensive information about the current branch state, including:
- Current branch name
- Working directory changes (modified/untracked files)
- Stash status for the current branch
- Package manager detection
- Remote tracking information
Implementation
Theshow_status function (src/main.rs:110-152) performs the following checks:
1. Branch name
Displays the current branch name in green:2. Changes detection
Checks for uncommitted changes usinghas_uncommitted_changes():
- If changes exist: Shows summary (e.g., “3 modified, 1 untracked”) in yellow
- If clean: Shows “clean” in dimmed text
3. Stash detection
Looks up the current branch in gitsw state:- Verifies the stash OID exists in the Git stash list
- Only shows if stash is actually present in Git
4. Package manager
Detects package manager by checking for lock files:package-lock.json→ npmyarn.lock→ yarnpnpm-lock.yaml→ pnpm
5. Remote tracking
Checks if the branch is tracking a remote:Example Output
Clean branch with no stash
Branch with uncommitted changes
Branch with stashed changes
New local branch (no remote tracking)
Output Fields
Name of the current branch (displayed in green).
Summary of uncommitted changes. Shows “clean” if no changes, otherwise displays count of modified and untracked files (in yellow).
Only displayed if a gitsw-managed stash exists for the current branch. Shows “present” in yellow.
Only displayed if a package manager lock file is detected. Shows package manager name (npm, yarn, or pnpm).
Only displayed if the branch is tracking a remote. Shows remote/branch format (e.g., “origin/main”).