1
Controlling file registration
 
 
2
=============================
 
 
4
What does Bazaar track?
 
 
5
-----------------------
 
 
7
As explained earlier, ``bzr add`` finds and registers all the things in
 
 
8
and under the current directory that Bazaar thinks ought to be
 
 
9
version controlled. These things may be:
 
 
15
Bazaar has default rules for deciding which files are
 
 
16
interesting and which ones are not. You can tune those rules as
 
 
17
explained in `Ignoring files`_ below.
 
 
19
Unlike many other VCS tools, Bazaar tracks directories as first class
 
 
20
items. As a consequence, empty directories are correctly supported -
 
 
21
you don't need to create a dummy file inside a directory just to
 
 
22
ensure it gets tracked and included in project exports.
 
 
24
For symbolic links, the value of the symbolic link is tracked,
 
 
25
not the content of the thing the symbolic link is pointing to.
 
 
27
Note: Support for tracking projects-within-projects ("nested trees")
 
 
28
is currently under development. Please contact the Bazaar developers
 
 
29
if you are interested in helping develop or test this functionality.
 
 
31
Selective registration
 
 
32
----------------------
 
 
34
In some cases, you may want or need to explicitly nominate the things
 
 
35
to register rather than leave it up to Bazaar to find things. To do this,
 
 
36
simply provide paths as arguments to the ``add`` command like this::
 
 
40
Adding a directory implicitly adds all interesting things
 
 
46
Many source trees contain some files that do not need to be versioned,
 
 
47
such as editor backups, object or bytecode files, and built programs.  You
 
 
48
can simply not add them, but then they'll always crop up as unknown files.
 
 
49
You can also tell Bazaar to ignore these files by adding them to a file
 
 
50
called ``.bzrignore`` at the top of the tree.
 
 
52
This file contains a list of file wildcards (or "globs"), one per line.
 
 
53
Typical contents are like this::
 
 
60
If a glob contains a slash, it is matched against the whole path from the
 
 
61
top of the tree; otherwise it is matched against only the filename.  So
 
 
62
the previous example ignores files with extension ``.o`` in all
 
 
63
subdirectories, but this example ignores only ``config.h`` at the top level
 
 
64
and HTML files in ``doc/``::
 
 
69
To get a list of which files are ignored and what pattern they matched,
 
 
76
Note that ignore patterns are only matched against non-versioned files,
 
 
77
and control whether they are treated as "unknown" or "ignored".  If a file
 
 
78
is explicitly added, it remains versioned regardless of whether it matches
 
 
81
The ``.bzrignore`` file should normally be versioned, so that new copies
 
 
82
of the branch see the same patterns::
 
 
85
    % bzr commit -m "Add ignore patterns"
 
 
87
The command ``bzr ignore PATTERN`` can be used to easily add PATTERN to
 
 
88
the ``.bzrignore file`` (creating it if necessary and registering it to
 
 
89
be tracked by Bazaar).  Removing and modifying patterns are done by
 
 
90
directly editing the ``.bzrignore`` file.
 
 
95
There are some ignored files which are not project specific, but more user
 
 
96
specific. Things like editor temporary files, or personal temporary files.
 
 
97
Rather than add these ignores to every project, bzr supports a global
 
 
98
ignore file in ``~/.bazaar/ignore`` [#]_. It has the same syntax as the
 
 
99
per-project ignore file.
 
 
101
.. [#] On Windows, the users configuration files can be found in the
 
 
102
   application data directory. So instead of ``~/.bazaar/branch.conf``
 
 
103
   the configuration file can be found as: 
 
 
104
   ``C:\Documents and Settings\<username>\Application Data\Bazaar\2.0\branch.conf``.
 
 
105
   The same is true for ``locations.conf``, ``ignore``, and the
 
 
106
   ``plugins`` directory.