man-pages/man1/git-check-ignore.1.html
2021-03-31 01:06:50 +01:00

177 lines
5.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GIT-CHECK-IGNORE</TITLE>
</HEAD><BODY>
<H1>GIT-CHECK-IGNORE</H1>
Section: Git Manual (1)<BR>Updated: 03/04/2021<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
git-check-ignore - Debug gitignore / exclude files
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<PRE>
<I>git check-ignore</I> [&lt;options&gt;] &lt;pathname&gt;...
<I>git check-ignore</I> [&lt;options&gt;] --stdin
</PRE>
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
For each pathname given via the command-line or from a file via <B>--stdin</B>, check whether the file is excluded by .gitignore (or other input files to the exclude mechanism) and output the path if it is excluded.
<P>
By default, tracked files are not shown at all since they are not subject to exclude rules; but see '--no-index'.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
-q, --quiet
<DL COMPACT><DT id="1"><DD>
Don't output anything, just set exit status. This is only valid with a single pathname.
</DL>
<P>
-v, --verbose
<DL COMPACT><DT id="2"><DD>
Also output details about the matching pattern (if any) for each given pathname. For precedence rules within and between exclude sources, see
<B><A HREF="/cgi-bin/man/man2html?5+gitignore">gitignore</A></B>(5).
</DL>
<P>
--stdin
<DL COMPACT><DT id="3"><DD>
Read pathnames from the standard input, one per line, instead of from the command-line.
</DL>
<P>
-z
<DL COMPACT><DT id="4"><DD>
The output format is modified to be machine-parsable (see below). If
<B>--stdin</B>
is also given, input paths are separated with a NUL character instead of a linefeed character.
</DL>
<P>
-n, --non-matching
<DL COMPACT><DT id="5"><DD>
Show given paths which don't match any pattern. This only makes sense when
<B>--verbose</B>
is enabled, otherwise it would not be possible to distinguish between paths which match a pattern and those which don't.
</DL>
<P>
--no-index
<DL COMPACT><DT id="6"><DD>
Don't look in the index when undertaking the checks. This can be used to debug why a path became tracked by e.g.
<B>git add .</B>
and was not ignored by the rules as expected by the user or when developing patterns including negation to match a path previously added with
<B>git add -f</B>.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>OUTPUT</H2>
<P>
By default, any of the given pathnames which match an ignore pattern will be output, one per line. If no pattern matches a given path, nothing will be output for that path; this means that path will not be ignored.
<P>
If <B>--verbose</B> is specified, the output is a series of lines of the form:
<P>
&lt;source&gt; &lt;COLON&gt; &lt;linenum&gt; &lt;COLON&gt; &lt;pattern&gt; &lt;HT&gt; &lt;pathname&gt;
<P>
&lt;pathname&gt; is the path of a file being queried, &lt;pattern&gt; is the matching pattern, &lt;source&gt; is the pattern's source file, and &lt;linenum&gt; is the line number of the pattern within that source. If the pattern contained a <B>!</B> prefix or <B>/</B> suffix, it will be preserved in the output. &lt;source&gt; will be an absolute path when referring to the file configured by <B>core.excludesFile</B>, or relative to the repository root when referring to <B>.git/info/exclude</B> or a per-directory exclude file.
<P>
If <B>-z</B> is specified, the pathnames in the output are delimited by the null character; if <B>--verbose</B> is also specified then null characters are also used instead of colons and hard tabs:
<P>
&lt;source&gt; &lt;NULL&gt; &lt;linenum&gt; &lt;NULL&gt; &lt;pattern&gt; &lt;NULL&gt; &lt;pathname&gt; &lt;NULL&gt;
<P>
If <B>-n</B> or <B>--non-matching</B> are specified, non-matching pathnames will also be output, in which case all fields in each output record except for &lt;pathname&gt; will be empty. This can be useful when running non-interactively, so that files can be incrementally streamed to STDIN of a long-running check-ignore process, and for each of these files, STDOUT will indicate whether that file matched a pattern or not. (Without this option, it would be impossible to tell whether the absence of output for a given file meant that it didn't match any pattern, or that the output hadn't been generated yet.)
<P>
Buffering happens as documented under the <B>GIT_FLUSH</B> option in <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1). The caller is responsible for avoiding deadlocks caused by overfilling an input buffer or reading from an empty output buffer.
<A NAME="lbAG">&nbsp;</A>
<H2>EXIT STATUS</H2>
<P>
0
<DL COMPACT><DT id="7"><DD>
One or more of the provided paths is ignored.
</DL>
<P>
1
<DL COMPACT><DT id="8"><DD>
None of the provided paths are ignored.
</DL>
<P>
128
<DL COMPACT><DT id="9"><DD>
A fatal error was encountered.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?5+gitignore">gitignore</A></B>(5) <B><A HREF="/cgi-bin/man/man2html?1+git-config">git-config</A></B>(1) <B><A HREF="/cgi-bin/man/man2html?1+git-ls-files">git-ls-files</A></B>(1)
<A NAME="lbAI">&nbsp;</A>
<H2>GIT</H2>
<P>
Part of the <B><A HREF="/cgi-bin/man/man2html?1+git">git</A></B>(1) suite
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="10"><A HREF="#lbAB">NAME</A><DD>
<DT id="11"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="12"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="13"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="14"><A HREF="#lbAF">OUTPUT</A><DD>
<DT id="15"><A HREF="#lbAG">EXIT STATUS</A><DD>
<DT id="16"><A HREF="#lbAH">SEE ALSO</A><DD>
<DT id="17"><A HREF="#lbAI">GIT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:13 GMT, March 31, 2021
</BODY>
</HTML>