7
Bazaar has been designed to make it easy to
8
recover from mistakes as explained below.
10
Dropping the revision history for a project
11
-------------------------------------------
13
If you accidently put the wrong tree under version control, simply
14
delete the ``.bzr`` directory.
16
Deregistering a file or directory
17
---------------------------------
19
If you accidently register a file using ``add`` that you
20
don't want version controlled, you can use the ``remove``
21
command to tell Bazaar to forget about it.
23
``remove`` has been designed to *Do the Right Thing* in
24
that it will leave the file on disk if it hasn't been
25
committed yet but delete it otherwise. For example::
28
(oops - didn't mean that)
30
(foo.html left on disk)
35
bzr commit -m "added TODO"
36
(hack, hack, hack - but don't change TODO)
40
If you want to insist on keeping the file, use the ``--keep`` option.
41
If you want to insist on removing the file, use the ``--force`` option.
43
Note: If you delete a file using your file manager, IDE or via an operating
44
system command, the ``commit`` command will implicitly treat it as removed.
46
Undoing changes since the last commit
47
-------------------------------------
49
One of the reasons for using a version control tool is that it
50
lets you easily checkpoint good tree states while working. If you
51
decide that the changes you have made since the last ``commit`` ought
52
to be thrown away, the command to use is ``revert`` like this::
56
As a precaution, it is good practice to use ``bzr diff`` first to
57
check that everything being thrown away really ought to be.
59
Undoing changes to a file since the last commit
60
-----------------------------------------------
62
If you want to undo changes to a particular file since the last commit but
63
keep all the other changes in the tree, pass the filename as an argument
64
to ``revert`` like this::
68
Undoing the last commit
69
-----------------------
71
If you make a commit and really didn't mean to, use the ``uncommit`` command
72
to undo it like this::
76
Unlike ``revert``, ``uncommit`` leaves the content of your working tree
77
exactly as it is. That's really handy if you make a commit and accidently
78
provide the wrong error message. For example::
80
bzr commit -m "Fix bug #11"
81
(damn - wrong bug number)
83
bzr commit -m "Fix bug #1"
85
Undoing an earlier commit
86
-------------------------
88
You can use the -r option to undo several commits like this:
92
If your reason for doing this is that you really want to
93
back out several changes, then be sure to remember that ``uncommit``
94
does not change your working tree: you'll probably need to run the
95
``revert`` command as well to complete the task. In many cases though,
96
it's arguably better to leave your history alone and add a new
97
revision reflecting the content of the last good state.
99
Reverting to the state of an earlier version
100
--------------------------------------------
102
If you make an unwanted change but it doesn't make sense to uncommit
103
it (because that code has been released to users say), you can use
104
``revert`` to take your working tree back to the desired state.
107
% bzr commit "Fix bug #5"
108
Committed revision 20.
112
bzr commit -m "Backout fix for bug #5"
117
If you have defined a tag prematurely, use the ``--force`` option of
118
the ``tag`` command to redefine it. For example::
121
(oops, we're not yet ready for that)
122
bzr tag 2.0-beta-1 --force
127
If you have defined a tag and no longer want it defined, use the
128
``--delete`` option of the ``tag`` command to remove it. For example::
131
(oops, we're not releasing a 4th beta)
132
bzr tag 2.0-beta-4 --delete