summaryrefslogtreecommitdiff
path: root/doc/hgignore.5
blob: 3535da71754b40473d98bbc17df759f92880c494 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
.\" Man page generated from reStructeredText.
.
.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 <command>\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.
.UNINDENT
.sp
The chosen syntax stays in effect when parsing all patterns that
follow, until another syntax is selected.
.sp
Neither glob 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.
.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 AUTHOR
.sp
Vadim Gelfer <\%vadim.gelfer@gmail.com\:>
.sp
Mercurial was written by Matt Mackall <\%mpm@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\-2012 Matt 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 <vadim.gelfer@gmail.com>

Organization: Mercurial
.\" Generated by docutils manpage writer.
.\" 
.