1HGIGNORE(5) Mercurial Manual HGIGNORE(5)
2
3
4
6 hgignore - syntax for Mercurial ignore files
7
9 The Mercurial system uses a file called .hgignore in the root directory
10 of a repository to control its behavior when it searches for files that
11 it is not currently tracking.
12
14 The working directory of a Mercurial repository will often contain
15 files that should not be tracked by Mercurial. These include backup
16 files created by editors and build products created by compilers.
17 These files can be ignored by listing them in a .hgignore file in the
18 root of the working directory. The .hgignore file must be created manu‐
19 ally. It is typically put under version control, so that the settings
20 will propagate to other repositories with push and pull.
21
22 An untracked file is ignored if its path relative to the repository
23 root directory, or any prefix path of that path, is matched against any
24 pattern in .hgignore.
25
26 For example, say we have an untracked file, file.c, at a/b/file.c
27 inside our repository. Mercurial will ignore file.c if any pattern in
28 .hgignore matches a/b/file.c, a/b or a.
29
30 In addition, a Mercurial configuration file can reference a set of
31 per-user or global ignore files. See the hgrc(5) man page for details
32 of how to configure these files. Look for the "ignore" entry in the
33 "ui" section.
34
35 To control Mercurial's handling of files that it manages, see the hg(1)
36 man page. Look for the -I and -X options.
37
39 An ignore file is a plain text file consisting of a list of patterns,
40 with one pattern per line. Empty lines are skipped. The # character is
41 treated as a comment character, and the \ character is treated as an
42 escape character.
43
44 Mercurial supports several pattern syntaxes. The default syntax used is
45 Python/Perl-style regular expressions.
46
47 To change the syntax used, use a line of the following form:
48
49 syntax: NAME
50
51 where NAME is one of the following:
52
53 regexp
54
55 Regular expression, Python/Perl syntax.
56
57 glob
58
59 Shell-style glob.
60
61 The chosen syntax stays in effect when parsing all patterns that fol‐
62 low, until another syntax is selected.
63
64 Neither glob nor regexp patterns are rooted. A glob-syntax pattern of
65 the form *.c will match a file ending in .c in any directory, and a
66 regexp pattern of the form \.c$ will do the same. To root a regexp pat‐
67 tern, start it with ^.
68
70 Here is an example ignore file.
71
72 # use glob syntax.
73 syntax: glob
74
75 *.elc
76 *.pyc
77 *~
78
79 # switch to regexp syntax.
80 syntax: regexp
81 ^\.pc/
82
84 Vadim Gelfer <vadim.gelfer@gmail.com>
85
86 Mercurial was written by Matt Mackall <mpm@selenic.com>.
87
89 hg(1), hgrc(5)
90
92 This manual page is copyright 2006 Vadim Gelfer. Mercurial is copy‐
93 right 2005-2009 Matt Mackall. Free use of this software is granted
94 under the terms of the GNU General Public License version 2.
95
97 Vadim Gelfer <vadim.gelfer@gmail.com>
98
99 Organization: Mercurial
100
101
102
103
104 HGIGNORE(5)