doc/hgignore.5.txt
author Martin Geisler <mg@lazybytes.net>
Tue, 21 Jul 2009 12:06:32 +0200
changeset 9182 3a319bc8906d
parent 9127 35c3f94233a0
child 9193 52de439b8d99
permissions -rw-r--r--
hgignore.5: expanded description - explain that .hgignore must be created manually - hint that it is typically put under revision control
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     1
HGIGNORE(5)
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     2
===========
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     3
Vadim Gelfer <vadim.gelfer@gmail.com>
8772
593d772434f7 man pages: add meta data
Martin Geisler <mg@lazybytes.net>
parents: 8771
diff changeset
     4
:man source: Mercurial
593d772434f7 man pages: add meta data
Martin Geisler <mg@lazybytes.net>
parents: 8771
diff changeset
     5
:man manual: Mercurial Manual
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     6
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     7
NAME
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     8
----
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     9
hgignore - syntax for Mercurial ignore files
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    10
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    11
SYNOPSIS
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    12
--------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    13
8766
b2059435f176 man pages: mark filenames and env vars as fixed text
Martin Geisler <mg@lazybytes.net>
parents: 8729
diff changeset
    14
The Mercurial system uses a file called `.hgignore` in the root
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    15
directory of a repository to control its behavior when it searches
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    16
for files that it is not currently tracking.
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    17
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    18
DESCRIPTION
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    19
-----------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    20
9182
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    21
The working directory of a Mercurial repository will often contain
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    22
files that should not be tracked by Mercurial. These include backup
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    23
files created by editors and build products created by compilers.
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    24
These files can be ignored by listing them in a `.hgignore` file in
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    25
the root of the working directory. The `.hgignore` file must be
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    26
created manually. It is typically put under version control, so that
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    27
the settings will propagate to other repositories with push and pull.
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    28
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    29
An untracked file is ignored if its path relative to the repository
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    30
root directory, or any prefix path of that path, is matched against
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    31
any pattern in `.hgignore`.
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    32
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    33
For example, say we have an an untracked file, `file.c`, at 
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    34
`a/b/file.c` inside our repository. Mercurial will ignore `file.c` if
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    35
any pattern in `.hgignore` matches `a/b/file.c`, `a/b` or `a`.
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    36
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    37
In addition, a Mercurial configuration file can reference a set of
6446
ee5313bc3c0c asciidoc: consistently use 1 space after full stop
Christian Ebert <blacktrash@gmx.net>
parents: 4635
diff changeset
    38
per-user or global ignore files. See the hgrc(5) man page for details
ee5313bc3c0c asciidoc: consistently use 1 space after full stop
Christian Ebert <blacktrash@gmx.net>
parents: 4635
diff changeset
    39
of how to configure these files. Look for the "ignore" entry in the
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    40
"ui" section.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    41
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    42
To control Mercurial's handling of files that it manages, see the
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    43
hg(1) man page. Look for the "-I" and "-X" options.
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    44
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    45
SYNTAX
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    46
------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    47
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    48
An ignore file is a plain text file consisting of a list of patterns,
8782
d19ab9a56bf4 doc: wrap man pages after fixing quoting
Martin Geisler <mg@lazybytes.net>
parents: 8780
diff changeset
    49
with one pattern per line. Empty lines are skipped. The "`#`"
d19ab9a56bf4 doc: wrap man pages after fixing quoting
Martin Geisler <mg@lazybytes.net>
parents: 8780
diff changeset
    50
character is treated as a comment character, and the "`\`" character
d19ab9a56bf4 doc: wrap man pages after fixing quoting
Martin Geisler <mg@lazybytes.net>
parents: 8780
diff changeset
    51
is treated as an escape character.
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    52
6446
ee5313bc3c0c asciidoc: consistently use 1 space after full stop
Christian Ebert <blacktrash@gmx.net>
parents: 4635
diff changeset
    53
Mercurial supports several pattern syntaxes. The default syntax used
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    54
is Python/Perl-style regular expressions.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    55
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    56
To change the syntax used, use a line of the following form:
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    57
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    58
syntax: NAME
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    59
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    60
where NAME is one of the following:
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    61
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    62
regexp::
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    63
  Regular expression, Python/Perl syntax.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    64
glob::
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    65
  Shell-style glob.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    66
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    67
The chosen syntax stays in effect when parsing all patterns that
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    68
follow, until another syntax is selected.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    69
6446
ee5313bc3c0c asciidoc: consistently use 1 space after full stop
Christian Ebert <blacktrash@gmx.net>
parents: 4635
diff changeset
    70
Neither glob nor regexp patterns are rooted. A glob-syntax pattern of
8782
d19ab9a56bf4 doc: wrap man pages after fixing quoting
Martin Geisler <mg@lazybytes.net>
parents: 8780
diff changeset
    71
the form "`*.c`" will match a file ending in "`.c`" in any directory,
d19ab9a56bf4 doc: wrap man pages after fixing quoting
Martin Geisler <mg@lazybytes.net>
parents: 8780
diff changeset
    72
and a regexp pattern of the form "`\.c$`" will do the same. To root a
d19ab9a56bf4 doc: wrap man pages after fixing quoting
Martin Geisler <mg@lazybytes.net>
parents: 8780
diff changeset
    73
regexp pattern, start it with "`^`".
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    74
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    75
EXAMPLE
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    76
-------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    77
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    78
Here is an example ignore file.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    79
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    80
  # use glob syntax.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    81
  syntax: glob
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    82
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    83
  *.elc
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    84
  *.pyc
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    85
  *~
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    86
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    87
  # switch to regexp syntax.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    88
  syntax: regexp
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    89
  ^\.pc/
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    90
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    91
AUTHOR
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    92
------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    93
Vadim Gelfer <vadim.gelfer@gmail.com>
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    94
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    95
Mercurial was written by Matt Mackall <mpm@selenic.com>.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    96
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    97
SEE ALSO
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    98
--------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    99
hg(1), hgrc(5)
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   100
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   101
COPYING
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   102
-------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   103
This manual page is copyright 2006 Vadim Gelfer.
8771
a2871de50f50 man pages: updated copyright years
Martin Geisler <mg@lazybytes.net>
parents: 8766
diff changeset
   104
Mercurial is copyright 2005-2009 Matt Mackall.
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   105
Free use of this software is granted under the terms of the GNU General
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   106
Public License (GPL).