Command

git check-ignore

Diagnoses ignore rules. Verbose output identifies the matched pattern, including negations. --no-index permits inspection of tracked paths; ordinary checks omit tracked paths. A plain single-path check returns 0 if ignored, 1 otherwise.

Formal Syntax & Structure

git syntaxgit
git check-ignore [-v] [--no-index] -- path

Working Example

Example Snippetgit
git check-ignore -v -- debug.log
Git Reference