doc/hgignore.5.txt
author Mads Kiilerich <mads@kiilerich.com>
Sat, 09 Oct 2010 07:13:47 -0500
changeset 12646 624859bf4314
parent 10263 25e572394f5c
child 14044 0528b69f8db4
permissions -rw-r--r--
test-notify: fix fix for line continuation in long mail header lines Continued lines can also start with space. Note that this hack also incorrectly patches the diff output.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     1
==========
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     2
 hgignore
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     3
==========
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
     4
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     5
---------------------------------
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     6
syntax for Mercurial ignore files
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     7
---------------------------------
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     8
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
     9
:Author:         Vadim Gelfer <vadim.gelfer@gmail.com>
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    10
:Organization:   Mercurial
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    11
:Manual section: 5
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    12
:Manual group:   Mercurial Manual
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    13
9792
dd1a95ccbe07 doc: use titlecase in man page section titles
Martin Geisler <mg@lazybytes.net>
parents: 9624
diff changeset
    14
Synopsis
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    15
--------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    16
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    17
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
    18
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
    19
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
    20
9792
dd1a95ccbe07 doc: use titlecase in man page section titles
Martin Geisler <mg@lazybytes.net>
parents: 9624
diff changeset
    21
Description
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    22
-----------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    23
9182
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    24
The working directory of a Mercurial repository will often contain
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    25
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
    26
files created by editors and build products created by compilers.
9194
0de7cf8db5fd hgignore.5: mark file names and cmdline options as literal text
Martin Geisler <mg@lazybytes.net>
parents: 9193
diff changeset
    27
These files can be ignored by listing them in a ``.hgignore`` file in
0de7cf8db5fd hgignore.5: mark file names and cmdline options as literal text
Martin Geisler <mg@lazybytes.net>
parents: 9193
diff changeset
    28
the root of the working directory. The ``.hgignore`` file must be
9182
3a319bc8906d hgignore.5: expanded description
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    29
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
    30
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
    31
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    32
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
    33
root directory, or any prefix path of that path, is matched against
9194
0de7cf8db5fd hgignore.5: mark file names and cmdline options as literal text
Martin Geisler <mg@lazybytes.net>
parents: 9193
diff changeset
    34
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
    35
9834
655ac26ad63e hgignore.5: fix typo
Martin Geisler <mg@lazybytes.net>
parents: 9792
diff changeset
    36
For example, say we have an untracked file, ``file.c``, at
9161
e8b653a4b8da doc: fixup font markup in man pages
Martin Geisler <mg@lazybytes.net>
parents: 9158
diff changeset
    37
``a/b/file.c`` inside our repository. Mercurial will ignore ``file.c``
e8b653a4b8da doc: fixup font markup in man pages
Martin Geisler <mg@lazybytes.net>
parents: 9158
diff changeset
    38
if any pattern in ``.hgignore`` matches ``a/b/file.c``, ``a/b`` or ``a``.
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    39
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    40
In addition, a Mercurial configuration file can reference a set of
9162
2399362b3bb0 doc: link man pages to one another
Martin Geisler <mg@lazybytes.net>
parents: 9161
diff changeset
    41
per-user or global ignore files. See the |hgrc(5)|_ man page for details
6446
ee5313bc3c0c asciidoc: consistently use 1 space after full stop
Christian Ebert <blacktrash@gmx.net>
parents: 4635
diff changeset
    42
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
    43
"ui" section.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    44
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    45
To control Mercurial's handling of files that it manages, see the
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9510
diff changeset
    46
|hg(1)|_ man page. Look for the ``-I`` and ``-X`` options.
9127
35c3f94233a0 hgignore.5.txt: improved description of matching
Henri Wiechers <hwiechers@gmail.com>
parents: 8782
diff changeset
    47
9792
dd1a95ccbe07 doc: use titlecase in man page section titles
Martin Geisler <mg@lazybytes.net>
parents: 9624
diff changeset
    48
Syntax
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    49
------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    50
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    51
An ignore file is a plain text file consisting of a list of patterns,
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9510
diff changeset
    52
with one pattern per line. Empty lines are skipped. The ``#``
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9510
diff changeset
    53
character is treated as a comment character, and the ``\`` character
8782
d19ab9a56bf4 doc: wrap man pages after fixing quoting
Martin Geisler <mg@lazybytes.net>
parents: 8780
diff changeset
    54
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
    55
6446
ee5313bc3c0c asciidoc: consistently use 1 space after full stop
Christian Ebert <blacktrash@gmx.net>
parents: 4635
diff changeset
    56
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
    57
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
    58
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    59
To change the syntax used, use a line of the following form::
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    60
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    61
  syntax: NAME
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    62
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    63
where ``NAME`` is one of the following:
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    64
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    65
``regexp``
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    66
  Regular expression, Python/Perl syntax.
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    67
``glob``
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    68
  Shell-style glob.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    69
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    70
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
    71
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
    72
6446
ee5313bc3c0c asciidoc: consistently use 1 space after full stop
Christian Ebert <blacktrash@gmx.net>
parents: 4635
diff changeset
    73
Neither glob nor regexp patterns are rooted. A glob-syntax pattern of
9624
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9510
diff changeset
    74
the form ``*.c`` will match a file ending in ``.c`` in any directory,
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9510
diff changeset
    75
and a regexp pattern of the form ``\.c$`` will do the same. To root a
585d2ffe969b doc, help: stream-line use of inline-literals
Martin Geisler <mg@lazybytes.net>
parents: 9510
diff changeset
    76
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
    77
9792
dd1a95ccbe07 doc: use titlecase in man page section titles
Martin Geisler <mg@lazybytes.net>
parents: 9624
diff changeset
    78
Example
2209
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
9158
d6eecafaf12f doc: use reStructuredText for man and HTML pages
Martin Geisler <mg@lazybytes.net>
parents: 9127
diff changeset
    81
Here is an example ignore file. ::
2209
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
  # use glob syntax.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    84
  syntax: glob
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
  *.elc
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    87
  *.pyc
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    88
  *~
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    89
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    90
  # switch to regexp syntax.
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    91
  syntax: regexp
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    92
  ^\.pc/
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    93
9792
dd1a95ccbe07 doc: use titlecase in man page section titles
Martin Geisler <mg@lazybytes.net>
parents: 9624
diff changeset
    94
Author
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    95
------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    96
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
    97
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
    98
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
    99
9792
dd1a95ccbe07 doc: use titlecase in man page section titles
Martin Geisler <mg@lazybytes.net>
parents: 9624
diff changeset
   100
See Also
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   101
--------
9162
2399362b3bb0 doc: link man pages to one another
Martin Geisler <mg@lazybytes.net>
parents: 9161
diff changeset
   102
|hg(1)|_, |hgrc(5)|_
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   103
9792
dd1a95ccbe07 doc: use titlecase in man page section titles
Martin Geisler <mg@lazybytes.net>
parents: 9624
diff changeset
   104
Copying
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   105
-------
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   106
This manual page is copyright 2006 Vadim Gelfer.
10209
c9194a7d7d3e Update copyright year to 2010
Pascal Quantin <pascal.quantin@gmail.com>
parents: 9834
diff changeset
   107
Mercurial is copyright 2005-2010 Matt Mackall.
2209
956e329f9e13 document hgignore syntax in new file doc/hgignore.5.txt.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
diff changeset
   108
Free use of this software is granted under the terms of the GNU General
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 10209
diff changeset
   109
Public License version 2 or any later version.
9162
2399362b3bb0 doc: link man pages to one another
Martin Geisler <mg@lazybytes.net>
parents: 9161
diff changeset
   110
2399362b3bb0 doc: link man pages to one another
Martin Geisler <mg@lazybytes.net>
parents: 9161
diff changeset
   111
.. include:: common.txt