~bzr-pqm/bzr/bzr.dev

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
Shelving Changes
================

Sometimes you will want to temporarily remove changes from your working
tree and restore them later, For instance to commit a small bug-fix you
found while working on something. Bazaar allows you to put changes on
a ``shelf`` to achieve this. When you want to restore the changes later
you can use ``unshelve`` to apply them to your working tree again.

For example, consider a working tree with one or more changes made ... ::

  $ bzr diff
  === modified file 'description.txt'
  --- description.txt
  +++ description.txt
  @@ -2,7 +2,7 @@
   ===============

   These plugins
  -by Michael Ellerman
  +written by Michael Ellerman
   provide a very
   fine-grained 'undo'
   facility
  @@ -11,6 +11,6 @@
   This allows you to
   undo some of
   your changes,
  -commit, and get
  +perform a commit, and get
   back to where you
   were before.

The ``shelve`` command interactively asks which changes
you want to retain in the working tree::

  $ bzr shelve
  --- description.txt
  +++ description.txt
  @@ -2,7 +2,7 @@
   ===============

   These plugins
  -by Michael Ellerman
  +written by Michael Ellerman
   provide a very
   fine-grained 'undo'
   facility

  Shelve? [yNfrq?]: y
  --- description.txt
  +++ description.txt
  @@ -11,6 +11,6 @@
   This allows you to
   undo some of
   your changes,
  -commit, and get
  +perform a commit, and get
   back to where you
   were before.

  Shelve? [yNfrq?]: n
  Shelve 2 change(s)? [yNfrq?]', 'y'
  Selected changes:
   M  description.txt
  Changes shelved with id "1".

If there are lots of changes in the working tree, you
can provide the ``shelve`` command with a list of files
and you will only be asked about changes in those files.
After shelving changes, it's a good idea to use ``diff``
to confirm the tree has just the changes you expect::

  $ bzr diff
  === modified file 'description.txt'
  --- description.txt
  +++ description.txt
  @@ -2,7 +2,7 @@
   ===============

   These plugins
  -by Michael Ellerman
  +written by Michael Ellerman
   provide a very
   fine-grained 'undo'
   facility

Great - you're ready to commit::

  $ bzr commit -m "improve first sentence"

At some later time, you can bring the shelved changes back into the
working tree using ``unshelve``::

  $ bzr unshelve
  Unshelving changes with id "1".
   M  description.txt
  All changes applied successfully.

If you want to, you can put multiple items on the shelf.
Normally each time you run ``unshelve`` the most recently
shelved changes will be reinstated. However, you can also
unshelve changes in a different order by explicitly
specifying which changes to unshelve.

Bazaar merges the changes in to your working tree, so they
will apply even if you have edited the files since you shelved
them, though they may conflict, in which case you will have to
resolve the conflicts in the same way you do after a conflicted
merge.