<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Controlling file registration — Bazaar 2.6.0 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.6.0', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/bzr.ico"/> <link rel="top" title="Bazaar 2.6.0 documentation" href="../index.html" /> <link rel="up" title="Bazaar User Guide" href="index.html" /> <link rel="next" title="Reviewing changes" href="reviewing_changes.html" /> <link rel="prev" title="Starting a project" href="starting_a_project.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="reviewing_changes.html" title="Reviewing changes" accesskey="N">next</a></li> <li class="right" > <a href="starting_a_project.html" title="Starting a project" accesskey="P">previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.6.0)</a> »</li> <li><a href="index.html" accesskey="U">Bazaar User Guide</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="controlling-file-registration"> <h1>Controlling file registration<a class="headerlink" href="#controlling-file-registration" title="Permalink to this headline">¶</a></h1> <div class="section" id="what-does-bazaar-track"> <h2>What does Bazaar track?<a class="headerlink" href="#what-does-bazaar-track" title="Permalink to this headline">¶</a></h2> <p>As explained earlier, <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">add</span></tt> finds and registers all the things in and under the current directory that Bazaar thinks ought to be version controlled. These things may be:</p> <blockquote> <div><ul class="simple"> <li>files</li> <li>directories</li> <li>symbolic links.</li> </ul> </div></blockquote> <p>Bazaar has default rules for deciding which files are interesting and which ones are not. You can tune those rules as explained in <a class="reference internal" href="#ignoring-files">Ignoring files</a> below.</p> <p>Unlike many other VCS tools, Bazaar tracks directories as first class items. As a consequence, empty directories are correctly supported - you don’t need to create a dummy file inside a directory just to ensure it gets tracked and included in project exports.</p> <p>For symbolic links, the value of the symbolic link is tracked, not the content of the thing the symbolic link is pointing to.</p> <p>Note: Support for tracking projects-within-projects (“nested trees”) is currently under development. Please contact the Bazaar developers if you are interested in helping develop or test this functionality.</p> </div> <div class="section" id="selective-registration"> <h2>Selective registration<a class="headerlink" href="#selective-registration" title="Permalink to this headline">¶</a></h2> <p>In some cases, you may want or need to explicitly nominate the things to register rather than leave it up to Bazaar to find things. To do this, simply provide paths as arguments to the <tt class="docutils literal"><span class="pre">add</span></tt> command like this:</p> <div class="highlight-python"><pre>bzr add fileX dirY/</pre> </div> <p>Adding a directory implicitly adds all interesting things underneath it.</p> </div> <div class="section" id="ignoring-files"> <h2>Ignoring files<a class="headerlink" href="#ignoring-files" title="Permalink to this headline">¶</a></h2> <p>Many source trees contain some files that do not need to be versioned, such as editor backups, object or bytecode files, and built programs. You can simply not add them, but then they’ll always crop up as unknown files. You can also tell Bazaar to ignore these files by adding them to a file called <tt class="docutils literal"><span class="pre">.bzrignore</span></tt> at the top of the tree.</p> <p>This file contains a list of file wildcards (or “globs”), one per line. Typical contents are like this:</p> <div class="highlight-python"><pre>*.o *~ *.tmp *.py[co]</pre> </div> <p>If a glob contains a slash, it is matched against the whole path from the top of the tree; otherwise it is matched against only the filename. So the previous example ignores files with extension <tt class="docutils literal"><span class="pre">.o</span></tt> in all subdirectories, but this example ignores only <tt class="docutils literal"><span class="pre">config.h</span></tt> at the top level and HTML files in <tt class="docutils literal"><span class="pre">doc/</span></tt>:</p> <div class="highlight-python"><pre>./config.h doc/*.html</pre> </div> <p>To get a list of which files are ignored and what pattern they matched, use <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">ignored</span></tt>:</p> <div class="highlight-python"><pre>% bzr ignored config.h ./config.h configure.in~ *~</pre> </div> <p>Note that ignore patterns are only matched against non-versioned files, and control whether they are treated as “unknown” or “ignored”. If a file is explicitly added, it remains versioned regardless of whether it matches an ignore pattern.</p> <p>The <tt class="docutils literal"><span class="pre">.bzrignore</span></tt> file should normally be versioned, so that new copies of the branch see the same patterns:</p> <div class="highlight-python"><pre>% bzr add .bzrignore % bzr commit -m "Add ignore patterns"</pre> </div> <p>The command <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">ignore</span> <span class="pre">PATTERN</span></tt> can be used to easily add PATTERN to the <tt class="docutils literal"><span class="pre">.bzrignore</span> <span class="pre">file</span></tt> (creating it if necessary and registering it to be tracked by Bazaar). Removing and modifying patterns are done by directly editing the <tt class="docutils literal"><span class="pre">.bzrignore</span></tt> file.</p> </div> <div class="section" id="global-ignores"> <h2>Global ignores<a class="headerlink" href="#global-ignores" title="Permalink to this headline">¶</a></h2> <p>There are some ignored files which are not project specific, but more user specific. Things like editor temporary files, or personal temporary files. Rather than add these ignores to every project, bzr supports a global ignore file in <tt class="docutils literal"><span class="pre">~/.bazaar/ignore</span></tt> <a class="footnote-reference" href="#id2" id="id1">[1]</a>. It has the same syntax as the per-project ignore file.</p> <table class="docutils footnote" frame="void" id="id2" rules="none"> <colgroup><col class="label" /><col /></colgroup> <tbody valign="top"> <tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>On Windows, the users configuration files can be found in the application data directory. So instead of <tt class="docutils literal"><span class="pre">~/.bazaar/branch.conf</span></tt> the configuration file can be found as: <tt class="docutils literal"><span class="pre">C:\Documents</span> <span class="pre">and</span> <span class="pre">Settings\<username>\Application</span> <span class="pre">Data\Bazaar\2.0\branch.conf</span></tt>. The same is true for <tt class="docutils literal"><span class="pre">locations.conf</span></tt>, <tt class="docutils literal"><span class="pre">ignore</span></tt>, and the <tt class="docutils literal"><span class="pre">plugins</span></tt> directory.</td></tr> </tbody> </table> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Controlling file registration</a><ul> <li><a class="reference internal" href="#what-does-bazaar-track">What does Bazaar track?</a></li> <li><a class="reference internal" href="#selective-registration">Selective registration</a></li> <li><a class="reference internal" href="#ignoring-files">Ignoring files</a></li> <li><a class="reference internal" href="#global-ignores">Global ignores</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="starting_a_project.html" title="previous chapter">Starting a project</a></p> <h4>Next topic</h4> <p class="topless"><a href="reviewing_changes.html" title="next chapter">Reviewing changes</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/user-guide/controlling_registration.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="reviewing_changes.html" title="Reviewing changes" >next</a></li> <li class="right" > <a href="starting_a_project.html" title="Starting a project" >previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.6.0)</a> »</li> <li><a href="index.html" >Bazaar User Guide</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2011 Canonical Ltd. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>