13
13
Over the next five minutes, you'll learn how to put your files under
14
14
version control, how to record changes to them, examine your work, publish
15
it and merge changes from someone else.
15
it and send your work for merger into a project's trunk.
17
If you'd prefer a more detailed introduction, take a look at our guide
17
If you'd prefer a more detailed introduction, take a look at
48
48
$ bzr whoami "John Doe <john.doe@gmail.com>"
50
Bazaar will now create or modify a configuration file, including your name
51
and email address, at ``~/.bazaar/bazaar.conf``
50
Bazaar will now create or modify a configuration file, including your
51
name and email address.
53
53
Now, check that your name and email address are correctly registered::
66
66
$ mkdir subdirectory
67
67
$ touch test1.txt test2.txt test3.txt subdirectory/test4.txt
69
**Note for Windows users:** use Windows Explorer to create your
70
directories, then right-click in those directories and select
71
``New file`` to create your files.
69
Now get Bazaar to initalise itself in that directory::
73
Now get Bazaar to initalize itself in your project directory::
86
90
added subdirectory/test4.txt
88
92
Next, take a snapshot of your files by committing them to your branch. Add
89
a commit message to explain why you made the commit::
93
a message to explain why you made the commit::
91
95
$ bzr commit -m "Initial import"
141
Publishing Your Branch
142
======================
144
There are a couple of ways to publish your branch but the easiest way is to
145
push it to Launchpad_, the free software project hosting service.
145
Publishing your branch with sftp
146
================================
148
There are a couple of ways to publish your branch. If you already have
149
an SFTP server or are comfortable setting one up, you can publish your
152
Otherwise, skip to the next section to publish with Launchpad_, a free
153
hosting service for Bazaar.
147
155
.. _Launchpad: https://launchpad.net/
157
Let's assume you want to publish your branch at ``www.example.com/myproject``::
159
$ bzr push --create-prefix sftp://your.name@example.com/~/public_html/myproject
160
2 revision(s) pushed.
162
Bazaar will create a ``myproject`` directory on the remote server and
163
push your branch to it.
165
**Note:** that to use sftp, your may need to install ``paramiko`` and
166
``pyCrypto``. See http://bazaar-vcs.org/InstallationFaq for details.
168
Now anyone can create their own copy of your branch by typing::
170
$ bzr branch http://www.example.com/myproject
173
Publishing your branch with Launchpad
174
=====================================
176
Launchpad is a suite of development and hosting tools for free
177
software projects. You can use it to publish your branch.
149
179
If you don't have a Launchpad account, follow the `account signup guide`_
150
and `register an SSH key`_ in your Launchpad account.
180
and `register an SSH key`_ in your new Launchpad account.
152
182
.. _account signup guide: https://help.launchpad.net/CreatingYourLaunchpadAccount
153
183
.. _register an SSH key: https://launchpad.net/people/+me/+editsshkeys
157
187
$ bzr push bzr+ssh://john.doe@bazaar.launchpad.net/~john.doe/+junk/myproject
159
``+junk`` means that this branch isn't associated with any particular
189
**Note:** ``+junk`` means that this branch isn't associated with any particular
160
190
project in Launchpad.
162
192
Now, anyone can create their own copy of your branch by typing::
164
194
$ bzr branch http://bazaar.launchpad.net/~john.doe/+junk/myproject
166
Their branch will have all the same files, with the same revision history
167
as yours but any changes they make will stay in their own branch. You
168
can merge your branches at any time.
170
**Note:** you can also push your branch to `your own server using sftp`_.
172
.. _your own server using sftp: push-with-sftp/
196
You can also see information about your branch, including its revision
197
history, at https://code.launchpad.net/people/+me/+junk/myproject
175
200
Creating your own copy of another branch
176
201
========================================
178
You can also make your own branch of someone else's work. Let's take a
179
real-world example, Bazaar's GTK interface::
203
To work with someone else's code, you can make your own copy of their
204
branch. Let's take a real-world example, Bazaar's GTK interface::
181
206
$ bzr branch http://bazaar.launchpad.net/~bzr/bzr-gtk/trunk bzr-gtk.john
182
207
Branched 292 revision(s).
184
209
Bazaar will download all the files and complete revision history from the
185
210
bzr-gtk project's trunk branch and create a copy called bzr-gtk.john.
187
Now, you have your own copy of the branch and can commit any changes you want
188
even without a net connection. You can share your branch at any time by
189
publishing it and, if the bzr-gtk team want to use your work, Bazaar makes it
190
easy for them to merge your branch back into their trunk branch.
212
Now, you have your own copy of the branch and can commit changes with
213
or without a net conncetion. You can share your branch at any time by
214
publishing it and, if the bzr-gtk team want to use your work, Bazaar
215
makes it easy for them to merge your branch back into their trunk branch.
193
218
Updating your branch from the main branch
194
219
=========================================
196
221
While you commit changes to your branch, it's likely that other people will
197
also continue to commit code to the main branch.
222
also continue to commit code to the parent branch.
199
224
To make sure your branch stays up to date, you should merge changes from
200
the main branch into your personal branch::
225
the parent into your personal branch::
203
228
Using saved location: http://bazaar.launchpad.net/~bzr/bzr-gtk/trunk
214
239
Committed revision 295.
220
After you've worked on your personal branch of a project, you may want to
221
send your changes back upstream. The easiest way is to use a Bazaar bundle.
223
Bundles are similar to patches, except they include revision history
226
To have Bazaar produce a bundle and email it to the project, replace
227
``project@projectdomain.com`` and type::
229
$ bzr send --mail-to=project@projectdomain.com
242
Merging your work into the parent branch
243
========================================
245
After you've worked on your personal branch of bzr-gtk, you may want to
246
send your changes back upstream to the project. The easiest way is to
249
Bundles are similar to patches but with added intelligent metadata,
250
such as revision history. They include all the information needed to
251
merge your branch back into the parent.
253
Replacing ``mybundle.patch``, create your bundle::
255
$ bzr send -o mybundle.patch
256
Using saved location: http://bazaar.launchpad.net/~bzr/bzr-gtk/trunk
258
You can now email the bundle to the upstream project who can, if they
259
choose, merge it back into trunk, i.e. the parent branch.
234
Now you've seen how to put your files under version control, make your
235
branch of someone else's work and send your code for merger with someone
238
265
You can find out more about Bazaar in the `Bazaar user guide <../../index.html>`_.
240
267
To learn about Bazaar on the command-line::