gitignore-scrub
Synopsis
Section titled “Synopsis”gitignore-scrub [-h] [-r] [-w | -f | -i]Description
Section titled “Description”Finds files that are tracked by git but now match a .gitignore pattern (git ls-files -ci --exclude-standard) and offers to untrack them. In the default interactive mode, prompts once for all matches and runs git rm --cached on confirmation; a decline is remembered per-path in the repo’s local git config (gitignore-scrub.skip) so the same file is not asked about again. -w/--warn is read-only: prints a Warning line per match and makes no changes, meant for non-interactive callers such as a git hook. -f/--force skips the prompt and untracks every match immediately. -i/--individual prompts once per file instead of once for the whole group. -w, -f, and -i are mutually exclusive. -r/--reset clears the repo’s skip list first (combinable with any mode), so previously declined files are reconsidered. Silently does nothing on a repo with more tracked files than $GITIGNORE_SCRUB_LIMIT (default 5000), to avoid adding latency to huge repos.
Arguments
Section titled “Arguments”-h, --help |
Show help message |
-r, --reset |
Clear the remembered skip list before checking |
-w, --warn |
Read-only: print warnings instead of prompting, make no changes |
-f, --force |
Untrack every match immediately, no prompt |
-i, --individual |
Prompt once per file instead of once for the whole group |
Exit Status
Section titled “Exit Status”0 |
Clean, or a prompt/force run was handled |
1 |
Not a git repository, or (-w only) unconfirmed matches were found |
2 |
Unknown option, or more than one of -w, -f and -i |
Example
Section titled “Example”gitignore-scrubgitignore-scrub --warngitignore-scrub --forcegitignore-scrub --individualgitignore-scrub --resetDependencies: git
Classification: blocking-prompt
Used by: gi