| 1 |
.\" Man page generated from reStructuredText. |
| 2 |
. |
| 3 |
.TH HGIGNORE 5 "" "" "Mercurial Manual" |
| 4 |
.SH NAME |
| 5 |
hgignore \- syntax for Mercurial ignore files |
| 6 |
. |
| 7 |
.nr rst2man-indent-level 0 |
| 8 |
. |
| 9 |
.de1 rstReportMargin |
| 10 |
\\$1 \\n[an-margin] |
| 11 |
level \\n[rst2man-indent-level] |
| 12 |
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] |
| 13 |
- |
| 14 |
\\n[rst2man-indent0] |
| 15 |
\\n[rst2man-indent1] |
| 16 |
\\n[rst2man-indent2] |
| 17 |
.. |
| 18 |
.de1 INDENT |
| 19 |
.\" .rstReportMargin pre: |
| 20 |
. RS \\$1 |
| 21 |
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] |
| 22 |
. nr rst2man-indent-level +1 |
| 23 |
.\" .rstReportMargin post: |
| 24 |
.. |
| 25 |
.de UNINDENT |
| 26 |
. RE |
| 27 |
.\" indent \\n[an-margin] |
| 28 |
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] |
| 29 |
.nr rst2man-indent-level -1 |
| 30 |
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] |
| 31 |
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u |
| 32 |
.. |
| 33 |
.SH SYNOPSIS |
| 34 |
.sp |
| 35 |
The Mercurial system uses a file called \fB.hgignore\fP in the root |
| 36 |
directory of a repository to control its behavior when it searches |
| 37 |
for files that it is not currently tracking. |
| 38 |
.SH DESCRIPTION |
| 39 |
.sp |
| 40 |
The working directory of a Mercurial repository will often contain |
| 41 |
files that should not be tracked by Mercurial. These include backup |
| 42 |
files created by editors and build products created by compilers. |
| 43 |
These files can be ignored by listing them in a \fB.hgignore\fP file in |
| 44 |
the root of the working directory. The \fB.hgignore\fP file must be |
| 45 |
created manually. It is typically put under version control, so that |
| 46 |
the settings will propagate to other repositories with push and pull. |
| 47 |
.sp |
| 48 |
An untracked file is ignored if its path relative to the repository |
| 49 |
root directory, or any prefix path of that path, is matched against |
| 50 |
any pattern in \fB.hgignore\fP. |
| 51 |
.sp |
| 52 |
For example, say we have an untracked file, \fBfile.c\fP, at |
| 53 |
\fBa/b/file.c\fP inside our repository. Mercurial will ignore \fBfile.c\fP |
| 54 |
if any pattern in \fB.hgignore\fP matches \fBa/b/file.c\fP, \fBa/b\fP or \fBa\fP. |
| 55 |
.sp |
| 56 |
In addition, a Mercurial configuration file can reference a set of |
| 57 |
per\-user or global ignore files. See the \fBignore\fP configuration |
| 58 |
key on the \fB[ui]\fP section of \%\fBhg help config\fP\: for details of how to |
| 59 |
configure these files. |
| 60 |
.sp |
| 61 |
To control Mercurial\(aqs handling of files that it manages, many |
| 62 |
commands support the \fB\-I\fP and \fB\-X\fP options; see |
| 63 |
\%\fBhg help <command>\fP\: and \%\fBhg help patterns\fP\: for details. |
| 64 |
.sp |
| 65 |
Files that are already tracked are not affected by .hgignore, even |
| 66 |
if they appear in .hgignore. An untracked file X can be explicitly |
| 67 |
added with \%\fBhg add X\fP\:, even if X would be excluded by a pattern |
| 68 |
in .hgignore. |
| 69 |
.SH SYNTAX |
| 70 |
.sp |
| 71 |
An ignore file is a plain text file consisting of a list of patterns, |
| 72 |
with one pattern per line. Empty lines are skipped. The \fB#\fP |
| 73 |
character is treated as a comment character, and the \fB\e\fP character |
| 74 |
is treated as an escape character. |
| 75 |
.sp |
| 76 |
Mercurial supports several pattern syntaxes. The default syntax used |
| 77 |
is Python/Perl\-style regular expressions. |
| 78 |
.sp |
| 79 |
To change the syntax used, use a line of the following form: |
| 80 |
.sp |
| 81 |
.nf |
| 82 |
.ft C |
| 83 |
syntax: NAME |
| 84 |
.ft P |
| 85 |
.fi |
| 86 |
.sp |
| 87 |
where \fBNAME\fP is one of the following: |
| 88 |
.INDENT 0.0 |
| 89 |
.TP |
| 90 |
.B \fBregexp\fP |
| 91 |
.sp |
| 92 |
Regular expression, Python/Perl syntax. |
| 93 |
.TP |
| 94 |
.B \fBglob\fP |
| 95 |
.sp |
| 96 |
Shell\-style glob. |
| 97 |
.TP |
| 98 |
.B \fBrootglob\fP |
| 99 |
.sp |
| 100 |
A variant of \fBglob\fP that is rooted (see below). |
| 101 |
.UNINDENT |
| 102 |
.sp |
| 103 |
The chosen syntax stays in effect when parsing all patterns that |
| 104 |
follow, until another syntax is selected. |
| 105 |
.sp |
| 106 |
Neither \fBglob\fP nor regexp patterns are rooted. A glob\-syntax |
| 107 |
pattern of the form \fB*.c\fP will match a file ending in \fB.c\fP in any |
| 108 |
directory, and a regexp pattern of the form \fB\e.c$\fP will do the |
| 109 |
same. To root a regexp pattern, start it with \fB^\fP. To get the same |
| 110 |
effect with glob\-syntax, you have to use \fBrootglob\fP. |
| 111 |
.sp |
| 112 |
Subdirectories can have their own .hgignore settings by adding |
| 113 |
\fBsubinclude:path/to/subdir/.hgignore\fP to the root \fB.hgignore\fP. See |
| 114 |
\%\fBhg help patterns\fP\: for details on \fBsubinclude:\fP and \fBinclude:\fP. |
| 115 |
.IP Note |
| 116 |
. |
| 117 |
Patterns specified in other than \fB.hgignore\fP are always rooted. |
| 118 |
Please see \%\fBhg help patterns\fP\: for details. |
| 119 |
.RE |
| 120 |
.SH EXAMPLE |
| 121 |
.sp |
| 122 |
Here is an example ignore file. |
| 123 |
.sp |
| 124 |
.nf |
| 125 |
.ft C |
| 126 |
# use glob syntax. |
| 127 |
syntax: glob |
| 128 |
|
| 129 |
*.elc |
| 130 |
*.pyc |
| 131 |
*~ |
| 132 |
|
| 133 |
# switch to regexp syntax. |
| 134 |
syntax: regexp |
| 135 |
^\e.pc/ |
| 136 |
.ft P |
| 137 |
.fi |
| 138 |
.SH DEBUGGING |
| 139 |
.sp |
| 140 |
Use the \fBdebugignore\fP command to see if and why a file is ignored, or to |
| 141 |
see the combined ignore pattern. See \%\fBhg help debugignore\fP\: for details. |
| 142 |
.SH AUTHOR |
| 143 |
.sp |
| 144 |
Vadim Gelfer <\%[email protected]\:> |
| 145 |
.sp |
| 146 |
Mercurial was written by Olivia Mackall <\%[email protected]\:>. |
| 147 |
.SH SEE ALSO |
| 148 |
.sp |
| 149 |
\%\fBhg\fP(1)\:, \%\fBhgrc\fP(5)\: |
| 150 |
.SH COPYING |
| 151 |
.sp |
| 152 |
This manual page is copyright 2006 Vadim Gelfer. |
| 153 |
Mercurial is copyright 2005\-2026 Olivia Mackall. |
| 154 |
Free use of this software is granted under the terms of the GNU General |
| 155 |
Public License version 2 or any later version. |
| 156 |
.\" Common link and substitution definitions. |
| 157 |
. |
| 158 |
.SH AUTHOR |
| 159 |
Vadim Gelfer <[email protected]> |
| 160 |
|
| 161 |
Organization: Mercurial |
| 162 |
.\" Generated by docutils manpage writer. |
| 163 |
.\" |
| 164 |
. |