git status
built-in 9.5% Savings
239 Commands
2.0K Tokens saved
7 Tests
Install
Safety checks passed
Filter definition
# git-status.toml — compact file listing with native git status codes
# Runs: git status --porcelain -b (branch header + XY status lines)
# Filtered: branch header transformed to name [±N]; file lines passed through unchanged
command = "git status"
# Override: use porcelain for reliable machine parsing
run = "git status --porcelain -b"
match_output = [
{ contains = "not a git repository", output = "Not a git repository" },
]
replace = [
# Detached HEAD
{ pattern = '^## HEAD \(no branch\).*$', output = "HEAD (detached)" },
# Branch with ahead/behind info: ## main...origin/main [ahead 2]
{ pattern = '^## (\S+?)(?:\.\.\.\S+)?\s+\[(.+)\]$', output = "{1} [{2}]" },
# Branch without ahead/behind: ## main...origin/main or ## main
{ pattern = '^## (\S+?)(?:\.\.\.\S+)?$', output = "{1}" },
# File lines pass through unchanged (XY codes are standard and understood by models)
]
Examples
all status types show correct file listing
~67 tokens → ~60 tokens
(10% saved)
Raw output
## feature-branch...origin/feature-branch [ahead 2] A src/new_module.rs AM src/half_staged.rs D old_file.rs D src/forgotten.rs M src/config.rs M src/main.rs M src/lib.rs MM src/both.rs R old_name.rs -> new_name.rs UU src/conflict.rs ?? untracked.txt ?? scratch.md
Filtered output
feature-branch [ahead 2] A src/new_module.rs AM src/half_staged.rs D old_file.rs D src/forgotten.rs M src/config.rs M src/main.rs M src/lib.rs MM src/both.rs R old_name.rs -> new_name.rs UU src/conflict.rs ?? untracked.txt ?? scratch.md
clean repo shows only branch name
~5 tokens → ~1 tokens
(80% saved)
Raw output
## main...origin/main
Filtered output
main
detached HEAD shows detached message
~11 tokens → ~7 tokens
(36% saved)
Raw output
## HEAD (no branch)...abc1234 M src/main.rs
Filtered output
HEAD (detached) M src/main.rs
diverged branch shows ahead and behind counts
~13 tokens → ~9 tokens
(31% saved)
Raw output
## main...origin/main [ahead 1, behind 2] M src/foo.rs
Filtered output
main [ahead 1, behind 2] M src/foo.rs
local-only branch with no upstream shows just branch name
~6 tokens → ~6 tokens
Raw output
## my-feature ?? scratch.rs
Filtered output
my-feature ?? scratch.rs
normal repo shows branch and file listing
~20 tokens → ~16 tokens
(20% saved)
Raw output
## main...origin/main M src/main.rs M src/lib.rs ?? new_file.txt ?? another.txt
Filtered output
main M src/main.rs M src/lib.rs ?? new_file.txt ?? another.txt
not a git repository shows friendly error
~17 tokens → ~5 tokens
(71% saved)
Raw output
fatal: not a git repository (or any of the parent directories): .git
Filtered output
Not a git repository
Warning: Community filters are third-party code. Review the filter definition above before installing it in production environments.Browse all filters