1HGIGNORE(5)                    Mercurial Manual                    HGIGNORE(5)
2
3
4

NAME

6       hgignore - syntax for Mercurial ignore files
7

SYNOPSIS

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

DESCRIPTION

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 ignore  configuration  key  on
32       the  [ui]  section  of  hg  help config for details of how to configure
33       these files.
34
35       To control Mercurial's handling of files that it manages, many commands
36       support  the  -I and -X options; see hg help <command> and hg help pat‐
37       terns for details.
38
39       Files that are already tracked are not affected by .hgignore,  even  if
40       they  appear  in .hgignore. An untracked file X can be explicitly added
41       with hg add X, even if X would be excluded by a pattern in .hgignore.
42

SYNTAX

44       An ignore file is a plain text file consisting of a list  of  patterns,
45       with  one pattern per line. Empty lines are skipped. The # character is
46       treated as a comment character, and the \ character is  treated  as  an
47       escape character.
48
49       Mercurial supports several pattern syntaxes. The default syntax used is
50       Python/Perl-style regular expressions.
51
52       To change the syntax used, use a line of the following form:
53
54       syntax: NAME
55
56       where NAME is one of the following:
57
58       regexp
59
60              Regular expression, Python/Perl syntax.
61
62       glob
63
64              Shell-style glob.
65
66       The chosen syntax stays in effect when parsing all patterns  that  fol‐
67       low, until another syntax is selected.
68
69       Neither  glob  nor regexp patterns are rooted. A glob-syntax pattern of
70       the form *.c will match a file ending in .c in  any  directory,  and  a
71       regexp pattern of the form \.c$ will do the same. To root a regexp pat‐
72       tern, start it with ^.
73
74       Note   Patterns specified in other than .hgignore  are  always  rooted.
75              Please see hg help patterns for details.
76

EXAMPLE

78       Here is an example ignore file.
79
80       # use glob syntax.
81       syntax: glob
82
83       *.elc
84       *.pyc
85       *~
86
87       # switch to regexp syntax.
88       syntax: regexp
89       ^\.pc/
90

AUTHOR

92       Vadim Gelfer <vadim.gelfer@gmail.com>
93
94       Mercurial was written by Matt Mackall <mpm@selenic.com>.
95

SEE ALSO

97       hg(1), hgrc(5)
98

COPYING

100       This  manual  page  is copyright 2006 Vadim Gelfer.  Mercurial is copy‐
101       right 2005-2012 Matt Mackall.  Free use of  this  software  is  granted
102       under  the  terms  of  the  GNU General Public License version 2 or any
103       later version.
104

AUTHOR

106       Vadim Gelfer <vadim.gelfer@gmail.com>
107
108       Organization: Mercurial
109
110
111
112
113                                                                   HGIGNORE(5)
Impressum