interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / Documentation / git-check-ignore.adoc

129 lines · 4159 bytes Raw Blame History
1git-check-ignore(1)
2===================
3
4NAME
5----
6git-check-ignore - Debug gitignore / exclude files
7
8
9SYNOPSIS
10--------
11[verse]
12'git check-ignore' [<options>] <pathname>...
13'git check-ignore' [<options>] --stdin
14
15DESCRIPTION
16-----------
17
18For each pathname given via the command-line or from a file via
19`--stdin`, check whether the file is excluded by .gitignore (or other
20input files to the exclude mechanism) and output the path if it is
21excluded.
22
23By default, tracked files are not shown at all since they are not
24subject to exclude rules; but see `--no-index'.
25
26OPTIONS
27-------
28-q::
29--quiet::
30 Don't output anything, just set exit status. This is only
31 valid with a single pathname.
32
33-v::
34--verbose::
35 Instead of printing the paths that are excluded, for each path
36 that matches an exclude pattern, print the exclude pattern
37 together with the path. (Matching an exclude pattern usually
38 means the path is excluded, but if the pattern begins with "`!`"
39 then it is a negated pattern and matching it means the path is
40 NOT excluded.)
41+
42For precedence rules within and between exclude sources, see
43linkgit:gitignore[5].
44
45--stdin::
46 Read pathnames from the standard input, one per line,
47 instead of from the command-line.
48
49-z::
50 The output format is modified to be machine-parsable (see
51 below). If `--stdin` is also given, input paths are separated
52 with a NUL character instead of a linefeed character.
53
54-n::
55--non-matching::
56 Show given paths which don't match any pattern. This only
57 makes sense when `--verbose` is enabled, otherwise it would
58 not be possible to distinguish between paths which match a
59 pattern and those which don't.
60
61--no-index::
62 Don't look in the index when undertaking the checks. This can
63 be used to debug why a path became tracked by e.g. `git add .`
64 and was not ignored by the rules as expected by the user or when
65 developing patterns including negation to match a path previously
66 added with `git add -f`.
67
68OUTPUT
69------
70
71By default, any of the given pathnames which match an ignore pattern
72will be output, one per line. If no pattern matches a given path,
73nothing will be output for that path; this means that path will not be
74ignored.
75
76If `--verbose` is specified, the output is a series of lines of the form:
77
78<source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>
79
80<pathname> is the path of a file being queried, <pattern> is the
81matching pattern, <source> is the pattern's source file, and <linenum>
82is the line number of the pattern within that source. If the pattern
83contained a "`!`" prefix or "`/`" suffix, it will be preserved in the
84output. <source> will be an absolute path when referring to the file
85configured by `core.excludesFile`, or relative to the repository root
86when referring to `.git/info/exclude` or a per-directory exclude file.
87
88If `-z` is specified, the pathnames in the output are delimited by the
89null character; if `--verbose` is also specified then null characters
90are also used instead of colons and hard tabs:
91
92<source> <NULL> <linenum> <NULL> <pattern> <NULL> <pathname> <NULL>
93
94If `-n` or `--non-matching` are specified, non-matching pathnames will
95also be output, in which case all fields in each output record except
96for <pathname> will be empty. This can be useful when running
97non-interactively, so that files can be incrementally streamed to
98STDIN of a long-running check-ignore process, and for each of these
99files, STDOUT will indicate whether that file matched a pattern or
100not. (Without this option, it would be impossible to tell whether the
101absence of output for a given file meant that it didn't match any
102pattern, or that the output hadn't been generated yet.)
103
104Buffering happens as documented under the `GIT_FLUSH` option in
105linkgit:git[1]. The caller is responsible for avoiding deadlocks
106caused by overfilling an input buffer or reading from an empty output
107buffer.
108
109EXIT STATUS
110-----------
111
1120::
113 One or more of the provided paths is ignored.
114
1151::
116 None of the provided paths are ignored.
117
118128::
119 A fatal error was encountered.
120
121SEE ALSO
122--------
123linkgit:gitignore[5]
124linkgit:git-config[1]
125linkgit:git-ls-files[1]
126
127GIT
128---
129Part of the linkgit:git[1] suite