/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/en/user-guide/reusing_a_checkout.txt

  • Committer: Andrew Bennetts
  • Date: 2008-01-04 03:12:11 UTC
  • mfrom: (3164 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3320.
  • Revision ID: andrew.bennetts@canonical.com-20080104031211-wy4uxo2j4elvip1j
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
configured into numerous development and testing tools. Once
21
21
again, reusing a checkout across multiple branches can help.
22
22
 
 
23
 
23
24
Changing where a branch is bound to
24
25
-----------------------------------
25
26
 
34
35
 3. Make your checkout a copy of the desired branch by using
35
36
    the ``update`` command followed by the ``revert`` command.
36
37
 
37
 
 
38
 
Note that simply binding to a new branch
39
 
and running ``update`` is not enough: you need the ``revert`` to
40
 
throw away any local differences in the working tree.
 
38
Note that simply binding to a new branch and running ``update``
 
39
merges in your local changes, both committed and uncommitted. You need
 
40
to decide whether to keep them or not by running either ``revert``
 
41
or ``commit``.
 
42
 
 
43
An alternative to the bind+update recipe is using the ``switch``
 
44
command. This is basically the same as removing the existing
 
45
branch and running ``checkout`` again on the new location, except
 
46
that any uncommitted changes in your tree are merged in.
 
47
 
 
48
Note: As ``switch`` can potentially throw away committed changes in
 
49
order to make a checkout an accurate cache of a different bound branch,
 
50
it will fail by design if there are changes which have been committed
 
51
locally but are not yet committed to the most recently bound branch.
 
52
To truly abandon these changes, use the ``--force`` option.
 
53
 
41
54
 
42
55
Switching a lightweight checkout
43
56
--------------------------------
44
57
 
45
 
If you have a lightweight checkout, there is no local history
46
 
to worry about. In this case, you
47
 
can simply alter the branch that the checkout (i.e.
48
 
working tree) is referring to by using the ``switch`` command.
49
 
 
 
58
With a lightweight checkout, there are no local commits and ``switch``
 
59
effectively changes which branch the working tree is associated with.
50
60
One possible setup is to use a lightweight checkout in combination
51
61
with a local tree-less repository. This lets you switch what you
52
62
are working on with ease. For example::
59
69
  (hack away)
60
70
 
61
71
Note that X-trunk in this example will have a ``.bzr`` directory within it
62
 
but their will be no working tree there as the branch was created in
 
72
but there will be no working tree there as the branch was created in
63
73
a tree-less repository. You can grab or create as many branches as you
64
74
need there and switch between them as required. For example::
65
75
 
71
81
  bzr switch ../X-trunk
72
82
  (go back to working on the trunk)
73
83
 
74
 
In many ways, ``switch`` operates like ``update`` in that it
75
 
refreshes your working tree and merges in any local changes you
76
 
have made. The primary different is that ``switch`` requires
77
 
a branch location and it is only supported (currently) on
78
 
lightweight checkouts.
79
 
 
80
84
Note: The branches may be local only or they may be bound to
81
85
remote ones (by creating them with ``checkout`` or by using ``bind``
82
 
after creating them with ``branch``). ``switch`` and ``bind`` are
83
 
similar but different: switch controls which branch the working tree
84
 
refers to while ``bind`` associates a remote branch to the local one.
 
86
after creating them with ``branch``).