<!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>Publishing a branch — 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="Using checkouts" href="using_checkouts.html" /> <link rel="prev" title="Centralized development" href="central_intro.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="using_checkouts.html" title="Using checkouts" accesskey="N">next</a></li> <li class="right" > <a href="central_intro.html" title="Centralized development" 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="publishing-a-branch"> <span id="id1"></span><h1>Publishing a branch<a class="headerlink" href="#publishing-a-branch" title="Permalink to this headline">¶</a></h1> <div class="section" id="setting-up-a-central-repository"> <h2>Setting up a central repository<a class="headerlink" href="#setting-up-a-central-repository" title="Permalink to this headline">¶</a></h2> <p>While the centralized workflow can be used by socially nominating any branch on any computer as the central one, in practice most teams have a dedicated server for hosting central branches.</p> <p>Just as it’s best practice to use a shared repository locally, it’s advisable to put central branches in a shared repository. Note that central shared branches typically only want to store history, not working copies of files, so their enclosing repository is usually creating using the <tt class="docutils literal"><span class="pre">no-trees</span></tt> option, e.g.:</p> <div class="highlight-python"><pre>bzr init-repo --no-trees bzr+ssh://centralhost/srv/bzr/PROJECT</pre> </div> <p>You can think of this step as similar to setting up a new cvsroot or Subversion repository. However, Bazaar gives you more flexibility in how branches may be organised in your repository. See <a class="reference external" href="shared_repository_layouts.html">Advanced shared repository layouts</a> in the appendices for guidelines and examples.</p> </div> <div class="section" id="starting-a-central-branch"> <h2>Starting a central branch<a class="headerlink" href="#starting-a-central-branch" title="Permalink to this headline">¶</a></h2> <p>There are two ways of populating a central branch with some initial content:</p> <blockquote> <div><ol class="arabic simple"> <li>Making a local branch and pushing it to a central location</li> <li>Making an empty central branch then committing content to it.</li> </ol> </div></blockquote> <p>Here is an example of the first way:</p> <div class="highlight-python"><pre>bzr init-repo PROJECT (prepare local repository) bzr init PROJECT/trunk cd PROJECT/trunk (copy development files) cp -ar ~/PROJECT . (copy files in using OS-specific tools) bzr add (populate repository; start version control) bzr commit -m "Initial import" (publish to central repository) bzr push bzr+ssh://centralhost/srv/bzr/PROJECT/trunk</pre> </div> <p>Here is an example of the second way:</p> <div class="highlight-python"><pre>bzr init-repo PROJECT (prepare local repository) cd PROJECT bzr init bzr+ssh://centralhost/srv/bzr/PROJECT/trunk bzr checkout bzr+ssh://centralhost/srv/bzr/PROJECT/trunk cd trunk cp -ar ~/PROJECT . (copy files in using OS-specific tools) bzr add (populate repository; start version control) bzr commit -m "Initial import" (publish to central repository)</pre> </div> <p>Note that committing inside a working tree created using the <tt class="docutils literal"><span class="pre">checkout</span></tt> command implicitly commits the content to the central location as well as locally. Had we used the <tt class="docutils literal"><span class="pre">branch</span></tt> command instead of <tt class="docutils literal"><span class="pre">checkout</span></tt> above, the content would have only been committed locally.</p> <p>Working trees that are tightly bound to a central location like this are called <em>checkouts</em>. The rest of this chapter explains their numerous features in more detail.</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="#">Publishing a branch</a><ul> <li><a class="reference internal" href="#setting-up-a-central-repository">Setting up a central repository</a></li> <li><a class="reference internal" href="#starting-a-central-branch">Starting a central branch</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="central_intro.html" title="previous chapter">Centralized development</a></p> <h4>Next topic</h4> <p class="topless"><a href="using_checkouts.html" title="next chapter">Using checkouts</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/user-guide/publishing_a_branch.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="using_checkouts.html" title="Using checkouts" >next</a></li> <li class="right" > <a href="central_intro.html" title="Centralized development" >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>