Debugging checklist: from git check-ignore to rsync -n
In one line: A five-step order that narrows “why is this committed / why is this missing from the deploy” in minutes, with the commands.
Ignore-rule problems leave no error message, which is why they take so long. Follow this order and most cases end within three steps.
1. Find the deciding rule
git check-ignore -v path/to/file
The output is source:line:pattern path. No output means the path is not ignored. Test paths that do not exist yet with --no-index. Pass several paths at once and only the ignored ones are printed, so a list of missing files can be piped through in one go.
2. Check whether it is already tracked
git ls-files -ci --exclude-standard
These are tracked files that a rule would ignore. .gitignore has no effect on tracked files, so they must be removed with git rm --cached, and in a shared repository that change must be committed.
3. Look at every rule source
Rules live in more than one file: the repository .gitignore, nested .gitignore files, .git/info/exclude and the global core.excludesFile. git check-ignore -v names the source that actually decided, so an unexpected file name in its output is your next stop.
4. If it is the deploy step, change tools
When git passes but the deploy misses files, the copy filter is the suspect. For rsync, use a dry run.
rsync -avn --itemize-changes --filter='merge .rsync-filter' src/ dest/
-n copies nothing and --itemize-changes summarises each item. Any path missing from that list points at filter order, because rsync stops at the first match.
5. In CI, feed the changed paths in
When a GitHub Actions workflow “did not run”, there is almost no log. Collect git diff --name-only origin/main...HEAD and compare it against the paths patterns; pasting them into this debugger shows which paths trigger and which are filtered.
Top five causes
- A lower
!is void because a parent directory is excluded. - The re-include sits above the exclusion.
- The file is already tracked.
- A pattern without a slash matches at any depth, wider than expected.
- rsync rule order is reversed (first match wins).
Put the same rules and paths into the debugger to see the winning line and the traps immediately.
Open GlobLabFrequently asked questions
`git check-ignore` prints nothing but the file is still ignored?
Then it is not ignored. Check index state, case sensitivity settings or sparse-checkout instead.
It behaves differently only in CI?
The checkout may differ: shallow clones and sparse-checkout affect path evaluation. Check the checkout step of the workflow.
Sources
Read next
- .gitignore order, re-includes, and the excluded-parent trapLast match wins, why a `!` re-include stops working under an excluded directory, and safer exception patterns, with examples.
- Pattern syntax: .gitignore versus GitHub Actions pathsHow `**`, `*`, `?` and `[]` differ between the two systems, and why paths and paths-ignore cannot be combined.
- The rsync include/exclude first-match trapRule order in rsync, directory pruning, and a filter order that survives backups, with broken and fixed examples.