Mercurial > hg
comparison mercurial/help/hgignore.txt @ 14044:0528b69f8db4
help: move hgignore man page into built-in help (issue2769)
author | Yun Lee <yun.lee.bj@gmail.com> |
---|---|
date | Sun, 17 Apr 2011 23:08:35 +0800 |
parents | |
children | 2d6f1b2c6a82 |
comparison
equal
deleted
inserted
replaced
14043:1c1e1232abdc | 14044:0528b69f8db4 |
---|---|
1 Synopsis | |
2 -------- | |
3 | |
4 The Mercurial system uses a file called ``.hgignore`` in the root | |
5 directory of a repository to control its behavior when it searches | |
6 for files that it is not currently tracking. | |
7 | |
8 Description | |
9 ----------- | |
10 | |
11 The working directory of a Mercurial repository will often contain | |
12 files that should not be tracked by Mercurial. These include backup | |
13 files created by editors and build products created by compilers. | |
14 These files can be ignored by listing them in a ``.hgignore`` file in | |
15 the root of the working directory. The ``.hgignore`` file must be | |
16 created manually. It is typically put under version control, so that | |
17 the settings will propagate to other repositories with push and pull. | |
18 | |
19 An untracked file is ignored if its path relative to the repository | |
20 root directory, or any prefix path of that path, is matched against | |
21 any pattern in ``.hgignore``. | |
22 | |
23 For example, say we have an untracked file, ``file.c``, at | |
24 ``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c`` | |
25 if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``. | |
26 | |
27 In addition, a Mercurial configuration file can reference a set of | |
28 per-user or global ignore files. See the | |
29 ``http://www.selenic.com/mercurial/hgrc.5.html`` man page for details | |
30 of how to configure these files. Look for the "ignore" entry in the | |
31 "ui" section. | |
32 | |
33 To control Mercurial's handling of files that it manages, see the | |
34 ``http://www.selenic.com/mercurial/hg.1.html`` man page. Look for | |
35 the ``-I`` and ``-X`` options. | |
36 | |
37 Syntax | |
38 ------ | |
39 | |
40 An ignore file is a plain text file consisting of a list of patterns, | |
41 with one pattern per line. Empty lines are skipped. The ``#`` | |
42 character is treated as a comment character, and the ``\`` character | |
43 is treated as an escape character. | |
44 | |
45 Mercurial supports several pattern syntaxes. The default syntax used | |
46 is Python/Perl-style regular expressions. | |
47 | |
48 To change the syntax used, use a line of the following form:: | |
49 | |
50 syntax: NAME | |
51 | |
52 where ``NAME`` is one of the following: | |
53 | |
54 ``regexp`` | |
55 Regular expression, Python/Perl syntax. | |
56 ``glob`` | |
57 Shell-style glob. | |
58 | |
59 The chosen syntax stays in effect when parsing all patterns that | |
60 follow, until another syntax is selected. | |
61 | |
62 Neither glob nor regexp patterns are rooted. A glob-syntax pattern of | |
63 the form ``*.c`` will match a file ending in ``.c`` in any directory, | |
64 and a regexp pattern of the form ``\.c$`` will do the same. To root a | |
65 regexp pattern, start it with ``^``. | |
66 | |
67 Example | |
68 ------- | |
69 | |
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/ |