/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/undoing_mistakes.txt

  • Committer: Ian Clatworthy
  • Date: 2007-12-04 06:39:55 UTC
  • mto: (3118.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3119.
  • Revision ID: ian.clatworthy@internode.on.net-20071204063955-350y8zg4sdvd24qe
Test more --old and --new combinations

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
Dropping the revision history for a project
11
11
-------------------------------------------
12
12
 
13
 
If you accidentally put the wrong tree under version control, simply
 
13
If you accidently put the wrong tree under version control, simply
14
14
delete the ``.bzr`` directory.
15
15
 
16
16
Deregistering a file or directory
17
17
---------------------------------
18
18
 
19
 
If you accidentally register a file using ``add`` that you
 
19
If you accidently register a file using ``add`` that you
20
20
don't want version controlled, you can use the ``remove``
21
21
command to tell Bazaar to forget about it.
22
22
 
23
 
``remove`` has been designed to *Do the Safe Thing* in
24
 
that it will not delete a modified file. For example::
 
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::
25
26
 
26
27
  bzr add foo.html
27
28
  (oops - didn't mean that)
28
29
  bzr remove foo.html
29
 
 
30
 
This will complain about the file being modified or unknown.
31
 
If you want to keep the file, use the ``--keep`` option.
32
 
Alternatively, if you want to delete the file, use the ``--force`` option.
33
 
For example::
34
 
 
35
 
  bzr add foo.html
36
 
  (oops - didn't mean that)
37
 
  bzr remove --keep foo.html
38
 
  (foo.html left on disk, but deregistered)
39
 
 
40
 
On the other hand, the unchanged ``TODO`` file is deregistered and
41
 
removed from disk without complaint in this example::
 
30
  (foo.html left on disk)
 
31
 
 
32
On the other hand::
42
33
 
43
34
  bzr add TODO
44
35
  bzr commit -m "added TODO"
46
37
  bzr remove TODO
47
38
  (TODO file deleted)
48
39
 
 
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.
 
42
 
49
43
Note: If you delete a file using your file manager, IDE or via an operating
50
44
system command, the ``commit`` command will implicitly treat it as removed.
51
45
 
59
53
 
60
54
  bzr revert
61
55
 
62
 
As a precaution, it is good practice to use ``bzr status`` and
63
 
``bzr diff`` first to check that everything being thrown away
64
 
really ought to be.
 
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.
65
58
 
66
59
Undoing changes to a file since the last commit
67
60
-----------------------------------------------
89
82
  bzr uncommit
90
83
  bzr commit -m "Fix bug #1"
91
84
 
92
 
Another common reason for undoing a commit is because you forgot to add
93
 
one or more files. Some users like to alias ``commit`` to ``commit --strict``
94
 
so that commits fail if unknown files are found in the tree.
95
 
 
96
 
Note: While the ``merge`` command is not introduced until the next
97
 
chapter, it is worth noting now that ``uncommit`` restores any pending
98
 
merges. (Running ``bzr status`` after ``uncommit`` will show these.)
99
 
``merge`` can also be used to effectively undo just a selected commit
100
 
earlier in history. For more information on ``merge``, see
101
 
`Merging changes <merging_changes.html>`_ in the next chapter and the
102
 
Bazaar User Reference.
103
 
 
104
 
Undoing multiple commits
105
 
------------------------
106
 
 
107
 
You can use the -r option to undo several commits like this::
 
85
Undoing an earlier commit
 
86
-------------------------
 
87
 
 
88
You can use the -r option to undo several commits like this:
108
89
 
109
90
  bzr uncommit -r -3
110
91
 
127
108
  Committed revision 20.
128
109
  (release the code)
129
110
  (hmm - bad fix)
130
 
  bzr revert -r 19
 
111
  bzr revert -r 20
131
112
  bzr commit -m "Backout fix for bug #5"
132
113
 
133
 
This will change your entire tree back to the state as of revision 19,
134
 
which is probably only what you want if you haven't made any new commits
135
 
since then. If you have, the ``revert`` would wipe them out as well. In that
136
 
case, you probably want to use `Reverse cherrypicking
137
 
<adv_merging.html#reverse-cherrypicking>`_ instead to
138
 
back out the bad fix.
139
 
 
140
 
Note: As an alternative to using an absolute revision number (like 19), you can
141
 
specify one relative to the tip (-1) using a negative number like this::
142
 
 
143
 
  bzr revert -r -2
144
 
 
145
114
Correcting a tag
146
115
----------------
147
116
 
150
119
 
151
120
  bzr tag 2.0-beta-1
152
121
  (oops, we're not yet ready for that)
153
 
  (make more commits to include more fixes)
154
122
  bzr tag 2.0-beta-1 --force
155
123
 
156
124
Clearing a tag