20
20
configured into numerous development and testing tools. Once
21
21
again, reusing a checkout across multiple branches can help.
23
24
Changing where a branch is bound to
24
25
-----------------------------------
34
35
3. Make your checkout a copy of the desired branch by using
35
36
the ``update`` command followed by the ``revert`` command.
37
Note that simply binding to a new branch
38
and running ``update`` merges in your local changes. You need
38
Note that simply binding to a new branch and running ``update``
39
merges in your local changes, both committed and uncommitted. You need
39
40
to decide whether to keep them or not by running either ``revert``
42
An alternative to the bind+update recipe is:
44
1. Use the ``unbind`` command to turn the checkout into a normal branch.
46
2. Run ``bzr pull --overwrite URL`` to make the branch a mirror of
49
3. Run ``bzr bind URL`` to bind to that URL.
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.
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.
51
55
Switching a lightweight checkout
52
56
--------------------------------
54
If you have a lightweight checkout, there is no local history
55
to worry about. In this case, you
56
can simply alter the branch that the checkout (i.e.
57
working tree) is referring to by using the ``switch`` command.
58
With a lightweight checkout, there are no local commits and ``switch``
59
effectively changes which branch the working tree is associated with.
59
60
One possible setup is to use a lightweight checkout in combination
60
61
with a local tree-less repository. This lets you switch what you
61
62
are working on with ease. For example::
80
81
bzr switch ../X-trunk
81
82
(go back to working on the trunk)
83
In many ways, ``switch`` operates like ``update`` in that it
84
refreshes your working tree and merges in any local changes you
85
have made. The primary different is that ``switch`` requires
86
a branch location and it is only supported (currently) on
87
lightweight checkouts. ``switch`` also only preserves
88
uncommitted changes while update keeps committed ones.
90
84
Note: The branches may be local only or they may be bound to
91
85
remote ones (by creating them with ``checkout`` or by using ``bind``
92
after creating them with ``branch``). ``switch`` and ``bind`` are
93
similar but different: switch controls which branch the working tree
94
refers to while ``bind`` associates a remote branch to the local one.
86
after creating them with ``branch``).