.\" Man page generated from reStructuredText. . .TH HGIGNORE 5 "" "" "Mercurial Manual" .SH NAME hgignore \- syntax for Mercurial ignore files . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .sp The Mercurial system uses a file called \fB.hgignore\fP in the root directory of a repository to control its behavior when it searches for files that it is not currently tracking. .SH DESCRIPTION .sp The working directory of a Mercurial repository will often contain files that should not be tracked by Mercurial. These include backup files created by editors and build products created by compilers. These files can be ignored by listing them in a \fB.hgignore\fP file in the root of the working directory. The \fB.hgignore\fP file must be created manually. It is typically put under version control, so that the settings will propagate to other repositories with push and pull. .sp An untracked file is ignored if its path relative to the repository root directory, or any prefix path of that path, is matched against any pattern in \fB.hgignore\fP. .sp For example, say we have an untracked file, \fBfile.c\fP, at \fBa/b/file.c\fP inside our repository. Mercurial will ignore \fBfile.c\fP if any pattern in \fB.hgignore\fP matches \fBa/b/file.c\fP, \fBa/b\fP or \fBa\fP. .sp In addition, a Mercurial configuration file can reference a set of per\-user or global ignore files. See the \fBignore\fP configuration key on the \fB[ui]\fP section of \%\fBhg help config\fP\: for details of how to configure these files. .sp To control Mercurial\(aqs handling of files that it manages, many commands support the \fB\-I\fP and \fB\-X\fP options; see \%\fBhg help \fP\: and \%\fBhg help patterns\fP\: for details. .sp Files that are already tracked are not affected by .hgignore, even if they appear in .hgignore. An untracked file X can be explicitly added with \%\fBhg add X\fP\:, even if X would be excluded by a pattern in .hgignore. .SH SYNTAX .sp An ignore file is a plain text file consisting of a list of patterns, with one pattern per line. Empty lines are skipped. The \fB#\fP character is treated as a comment character, and the \fB\e\fP character is treated as an escape character. .sp Mercurial supports several pattern syntaxes. The default syntax used is Python/Perl\-style regular expressions. .sp To change the syntax used, use a line of the following form: .sp .nf .ft C syntax: NAME .ft P .fi .sp where \fBNAME\fP is one of the following: .INDENT 0.0 .TP .B \fBregexp\fP .sp Regular expression, Python/Perl syntax. .TP .B \fBglob\fP .sp Shell\-style glob. .TP .B \fBrootglob\fP .sp A variant of \fBglob\fP that is rooted (see below). .UNINDENT .sp The chosen syntax stays in effect when parsing all patterns that follow, until another syntax is selected. .sp Neither \fBglob\fP nor regexp patterns are rooted. A glob\-syntax pattern of the form \fB*.c\fP will match a file ending in \fB.c\fP in any directory, and a regexp pattern of the form \fB\e.c$\fP will do the same. To root a regexp pattern, start it with \fB^\fP. To get the same effect with glob\-syntax, you have to use \fBrootglob\fP. .sp Subdirectories can have their own .hgignore settings by adding \fBsubinclude:path/to/subdir/.hgignore\fP to the root \fB.hgignore\fP. See \%\fBhg help patterns\fP\: for details on \fBsubinclude:\fP and \fBinclude:\fP. .IP Note . Patterns specified in other than \fB.hgignore\fP are always rooted. Please see \%\fBhg help patterns\fP\: for details. .RE .SH EXAMPLE .sp Here is an example ignore file. .sp .nf .ft C # use glob syntax. syntax: glob *.elc *.pyc *~ # switch to regexp syntax. syntax: regexp ^\e.pc/ .ft P .fi .SH DEBUGGING .sp Use the \fBdebugignore\fP command to see if and why a file is ignored, or to see the combined ignore pattern. See \%\fBhg help debugignore\fP\: for details. .SH AUTHOR .sp Vadim Gelfer <\%vadim.gelfer@gmail.com\:> .sp Mercurial was written by Olivia Mackall <\%olivia@selenic.com\:>. .SH SEE ALSO .sp \%\fBhg\fP(1)\:, \%\fBhgrc\fP(5)\: .SH COPYING .sp This manual page is copyright 2006 Vadim Gelfer. Mercurial is copyright 2005\-2024 Olivia Mackall. Free use of this software is granted under the terms of the GNU General Public License version 2 or any later version. .\" Common link and substitution definitions. . .SH AUTHOR Vadim Gelfer Organization: Mercurial .\" Generated by docutils manpage writer. .\" .