Publishing a branch =================== Setting up a central repository ------------------------------- 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. 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 ``no-trees`` option, e.g.:: bzr init-repo --no-trees sftp://centralhost/srv/bzr/PROJECT 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 `Advanced shared repository layouts`_ in the appendices for guidelines and examples. Starting a central branch ------------------------- There are two ways of populating a central branch with some initial content: 1. Making a local branch and pushing it to a central location 2. Making an empty central branch then committing content to it. Here is an example of the first way:: 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 sftp://centralhost/srv/bzr/PROJECT/trunk Here is an example of the second way:: bzr init-repo PROJECT (prepare local repository) cd PROJECT bzr init sftp://centralhost/srv/bzr/PROJECT/trunk bzr checkout sftp://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) bzr push sftp://centralhost/srv/bzr/project/trunk Note that committing inside a working tree created using the ``checkout`` command implicitly commits the content to the central location as well as locally. Had we used the ``branch`` command instead of ``checkout`` above, the content would have only been committed locally. Working trees that are tightly bound to a central location like this are called *checkouts*. The rest of this chapter explains their numerous features in more detail.