<!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>Starting a project — 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="Controlling file registration" href="controlling_registration.html" /> <link rel="prev" title="Going solo" href="solo_intro.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="controlling_registration.html" title="Controlling file registration" accesskey="N">next</a></li> <li class="right" > <a href="solo_intro.html" title="Going solo" 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="starting-a-project"> <h1>Starting a project<a class="headerlink" href="#starting-a-project" title="Permalink to this headline">¶</a></h1> <div class="section" id="putting-an-existing-project-under-version-control"> <h2>Putting an existing project under version control<a class="headerlink" href="#putting-an-existing-project-under-version-control" title="Permalink to this headline">¶</a></h2> <p>If you already have a tree of source code (or directory of documents) you wish to put under version control, here are the commands to use:</p> <div class="highlight-python"><div class="highlight"><pre>cd my-stuff bzr init bzr add bzr commit -m "Initial import" </pre></div> </div> <p><tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">init</span></tt> creates a <tt class="docutils literal"><span class="pre">.bzr</span></tt> directory in the top level directory (<tt class="docutils literal"><span class="pre">my-stuff</span></tt> in the example above). Note that:</p> <blockquote> <div><ul class="simple"> <li>Bazaar has everything it needs in that directory - you do <strong>not</strong> need to setup a database, web server or special service to use it</li> <li>Bazaar is polite enough to only create one <tt class="docutils literal"><span class="pre">.bzr</span></tt> in the directory given, not one in every subdirectory thereof.</li> </ul> </div></blockquote> <p><tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">add</span></tt> then finds all the files and directories it thinks ought to be version controlled and registers them internally. <tt class="docutils literal"><span class="pre">bzr</span> <span class="pre">commit</span></tt> then records a snapshot of the content of these and records that information, together with a commit message.</p> <p>More information on <tt class="docutils literal"><span class="pre">init</span></tt>, <tt class="docutils literal"><span class="pre">add</span></tt> and <tt class="docutils literal"><span class="pre">commit</span></tt> will be provided later. For now, the important thing to remember is the recipe above.</p> </div> <div class="section" id="starting-a-new-project"> <h2>Starting a new project<a class="headerlink" href="#starting-a-new-project" title="Permalink to this headline">¶</a></h2> <p>If you are starting a project from scratch, you can also use the recipe above, after creating an empty directory first of course. For efficiency reasons that will be explored more in later chapters though, it is a good idea to create a repository for the project at the top level and to nest a <em>main</em> branch within it like this:</p> <div class="highlight-python"><div class="highlight"><pre>bzr init-repo my.repo cd my.repo bzr init my.main cd my.main hack, hack, hack bzr add bzr commit -m "Initial import" </pre></div> </div> <p>Some users prefer a name like <em>trunk</em> or <em>dev</em> to <em>main</em>. Choose whichever name makes the most sense to you.</p> <p>Note that the <tt class="docutils literal"><span class="pre">init-repo</span></tt> and <tt class="docutils literal"><span class="pre">init</span></tt> commands both take a path as an argument and will create that path if it doesn’t already exist.</p> </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="#">Starting a project</a><ul> <li><a class="reference internal" href="#putting-an-existing-project-under-version-control">Putting an existing project under version control</a></li> <li><a class="reference internal" href="#starting-a-new-project">Starting a new project</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="solo_intro.html" title="previous chapter">Going solo</a></p> <h4>Next topic</h4> <p class="topless"><a href="controlling_registration.html" title="next chapter">Controlling file registration</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/user-guide/starting_a_project.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="controlling_registration.html" title="Controlling file registration" >next</a></li> <li class="right" > <a href="solo_intro.html" title="Going solo" >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-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>