1<div id="Adding-and-removing"></div>
2<table class="header" cellpadding="1" cellspacing="1" border="0">
3<tr><td valign="middle" align="left">|[[cvs: Recursive behavior#Recursive behavior| &lt;&lt; ]]|</td>
4<td valign="middle" align="left">|[[cvs: Recursive behavior#Recursive behavior| &lt; ]]|</td>
5<td valign="middle" align="left">|[[cvs#Top| Up ]]|</td>
6<td valign="middle" align="left">|[[#Adding files to a directory| &gt; ]]|</td>
7<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
8<td valign="middle" align="left"> &nbsp; </td>
9<td valign="middle" align="left"> &nbsp; </td>
10<td valign="middle" align="left"> &nbsp; </td>
11<td valign="middle" align="left"> &nbsp; </td>
12<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
13<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
14<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
15<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
16</tr></table>
17<div id="Adding_002c-removing_002c-and-renaming-files-and-directories"></div>
18== Adding, removing, and renaming files and directories ==
19
20In the course of a project, one will often add new
21files.  Likewise with removing or renaming, or with
22directories.  The general concept to keep in mind in
23all these cases is that instead of making an
24irreversible change you want <small>CVS</small> to record the
25fact that a change has taken place, just as with
26modifying an existing file.  The exact mechanisms to do
27this in <small>CVS</small> vary depending on the situation.
28
29<div class="menu-preformatted" style="font-family: serif">
30 [[#Adding files to a directory|&bull; Adding files]]::                Adding files
31 [[#Removing files|&bull; Removing files]]::              Removing files
32 [[#Removing directories|&bull; Removing directories]]::        Removing directories
33 [[#Moving and renaming files|&bull; Moving files]]::                Moving and renaming files
34 [[#Moving and renaming directories|&bull; Moving directories]]::          Moving and renaming directories
35</div>
36
37
38----
39
40<div id="Adding-files"></div>
41<table class="header" cellpadding="1" cellspacing="1" border="0">
42<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
43<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt; ]]|</td>
44<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
45<td valign="middle" align="left">|[[#Removing files| &gt; ]]|</td>
46<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
47<td valign="middle" align="left"> &nbsp; </td>
48<td valign="middle" align="left"> &nbsp; </td>
49<td valign="middle" align="left"> &nbsp; </td>
50<td valign="middle" align="left"> &nbsp; </td>
51<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
52<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
53<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
54<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
55</tr></table>
56<div id="Adding-files-to-a-directory"></div>
57=== Adding files to a directory ===
58<div id="index-Adding-files"></div>
59
60To add a new file to a directory, follow these steps.
61
62
63* You must have a working copy of the directory. See section [[cvs: Overview#Getting the source|Getting the source]].
64
65
66* Create the new file inside your working copy of the directory.
67
68
69* Use &lsquo;<code>cvs add <var>filename</var></code>&rsquo; to tell <small>CVS</small> that you want to version control the file.  If the file contains binary data, specify &lsquo;<code>-kb</code>&rsquo; (see section [[cvs: Handling binary files#Handling binary files|Handling binary files]]).
70
71
72* Use &lsquo;<code>cvs commit <var>filename</var></code>&rsquo; to actually check in the file into the repository.  Other developers cannot see the file until you perform this step.
73
74You can also use the <code>add</code> command to add a new
75directory.
76
77Unlike most other commands, the <code>add</code> command is
78not recursive.  You cannot even type &lsquo;<code>cvs add
79foo/bar</code>&rsquo;!  Instead, you have to
80
81<div class="example" style="margin-left: 3.2em">
82 $ cd foo
83 $ cvs add bar
84</div>
85
86<div id="index-add-_0028subcommand_0029"></div>
87;<div id="index-cvs-add"></div>Command<nowiki>:</nowiki> <strong>cvs add</strong><em> <nowiki>[</nowiki><code>-k</code> kflag<nowiki>]</nowiki> <nowiki>[</nowiki><code>-m</code> message<nowiki>]</nowiki> files &hellip;</em>
88
89: Schedule <var>files</var> to be added to the repository. The files or directories specified with <code>add</code> must already exist in the current directory.  To add a whole new directory hierarchy to the source repository (for example, files received from a third-party vendor), use the <code>import</code> command instead.  See section [[cvs: Guide to CVS commands#import&mdash;Import sources into CVS, using vendor branches|import&mdash;Import sources into CVS, using vendor branches]].
90
91: The added files are not placed in the source repository until you use <code>commit</code> to make the change permanent.  Doing an <code>add</code> on a file that was removed with the <code>remove</code> command will undo the effect of the <code>remove</code>, unless a <code>commit</code> command intervened.  See section [[#Removing files|Removing files]], for an example.
92
93: The &lsquo;<code>-k</code>&rsquo; option specifies the default way that this file will be checked out; for more information see [[cvs: Keyword substitution#Substitution modes|Substitution modes]].
94
95: The &lsquo;<code>-m</code>&rsquo; option specifies a description for the file.  This description appears in the history log (if it is enabled, see section [[cvs: Reference manual for Administrative files#The history file|The history file]]).  It will also be saved in the version history inside the repository when the file is committed.  The <code>log</code> command displays this description.  The description can be changed using &lsquo;<code>admin -t</code>&rsquo;.  See section [[cvs: Guide to CVS commands#admin&mdash;Administration|admin&mdash;Administration]].  If you omit the &lsquo;<code>-m <var>description</var></code>&rsquo; flag, an empty string will be used.  You will not be prompted for a description.
96
97For example, the following commands add the file
98&lsquo;<tt>backend.c</tt>&rsquo; to the repository:
99
100<div class="example" style="margin-left: 3.2em">
101 $ cvs add backend.c
102 $ cvs commit -m &quot;Early version. Not yet compilable.&quot; backend.c
103</div>
104
105When you add a file it is added only on the branch
106which you are working on (see section [[cvs: Branching and merging#Branching and merging|Branching and merging]]).  You can
107later merge the additions to another branch if you want
108(see section [[cvs: Branching and merging#Merging can add or remove files|Merging can add or remove files]]).
109
110
111----
112
113<div id="Removing-files"></div>
114<table class="header" cellpadding="1" cellspacing="1" border="0">
115<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
116<td valign="middle" align="left">|[[#Adding files to a directory| &lt; ]]|</td>
117<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
118<td valign="middle" align="left">|[[#Removing directories| &gt; ]]|</td>
119<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
120<td valign="middle" align="left"> &nbsp; </td>
121<td valign="middle" align="left"> &nbsp; </td>
122<td valign="middle" align="left"> &nbsp; </td>
123<td valign="middle" align="left"> &nbsp; </td>
124<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
125<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
126<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
127<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
128</tr></table>
129<div id="Removing-files-1"></div>
130=== Removing files ===
131<div id="index-Removing-files"></div>
132<div id="index-Deleting-files"></div>
133
134Directories change.  New files are added, and old files
135disappear.  Still, you want to be able to retrieve an
136exact copy of old releases.
137
138Here is what you can do to remove a file,
139but remain able to retrieve old revisions:
140
141
142* Make sure that you have not made any uncommitted modifications to the file.  See section [[cvs: Overview#Viewing differences|Viewing differences]], for one way to do that.  You can also use the <code>status</code> or <code>update</code> command.  If you remove the file without committing your changes, you will of course not be able to retrieve the file as it was immediately before you deleted it.
143
144
145* Remove the file from your working copy of the directory. You can for instance use <code>rm</code>.
146
147
148* Use &lsquo;<code>cvs remove <var>filename</var></code>&rsquo; to tell <small>CVS</small> that you really want to delete the file.
149
150
151* Use &lsquo;<code>cvs commit <var>filename</var></code>&rsquo; to actually perform the removal of the file from the repository.
152
153When you commit the removal of the file, <small>CVS</small>
154records the fact that the file no longer exists.  It is
155possible for a file to exist on only some branches and
156not on others, or to re-add another file with the same
157name later.  <small>CVS</small> will correctly create or not create
158the file, based on the &lsquo;<code>-r</code>&rsquo; and &lsquo;<code>-D</code>&rsquo; options
159specified to <code>checkout</code> or <code>update</code>.
160
161<div id="index-Remove-_0028subcommand_0029"></div>
162;<div id="index-cvs-remove"></div>Command<nowiki>:</nowiki> <strong>cvs remove</strong><em> <nowiki>[</nowiki>options<nowiki>]</nowiki> files &hellip;</em>
163
164: Schedule file(s) to be removed from the repository (files which have not already been removed from the working directory are not processed).  This command does not actually remove the file from the repository until you commit the removal.  For a full list of options, see [[cvs: Quick reference to CVS commands#Quick reference to CVS commands|Quick reference to CVS commands]].
165
166Here is an example of removing several files:
167
168<div class="example" style="margin-left: 3.2em">
169 $ cd test
170 $ rm *.c
171 $ cvs remove
172 cvs remove: Removing .
173 cvs remove: scheduling a.c for removal
174 cvs remove: scheduling b.c for removal
175 cvs remove: use 'cvs commit' to remove these files permanently
176 $ cvs ci -m &quot;Removed unneeded files&quot;
177 cvs commit: Examining .
178 cvs commit: Committing .
179</div>
180
181As a convenience you can remove the file and <code>cvs
182remove</code> it in one step, by specifying the &lsquo;<code>-f</code>&rsquo;
183option.  For example, the above example could also be
184done like this:
185
186<div class="example" style="margin-left: 3.2em">
187 $ cd test
188 $ cvs remove -f *.c
189 cvs remove: scheduling a.c for removal
190 cvs remove: scheduling b.c for removal
191 cvs remove: use 'cvs commit' to remove these files permanently
192 $ cvs ci -m &quot;Removed unneeded files&quot;
193 cvs commit: Examining .
194 cvs commit: Committing .
195</div>
196
197If you execute <code>remove</code> for a file, and then
198change your mind before you commit, you can undo the
199<code>remove</code> with an <code>add</code> command.
200
201
202<div class="example" style="margin-left: 3.2em">
203 $ ls
204 CVS   ja.h  oj.c
205 $ rm oj.c
206 $ cvs remove oj.c
207 cvs remove: scheduling oj.c for removal
208 cvs remove: use 'cvs commit' to remove this file permanently
209 $ cvs add oj.c
210 U oj.c
211 cvs add: oj.c, version 1.1.1.1, resurrected
212</div>
213
214If you realize your mistake before you run the
215<code>remove</code> command you can use <code>update</code> to
216resurrect the file:
217
218<div class="example" style="margin-left: 3.2em">
219 $ rm oj.c
220 $ cvs update oj.c
221 cvs update: warning: oj.c was lost
222 U oj.c
223</div>
224
225When you remove a file it is removed only on the branch
226which you are working on (see section [[cvs: Branching and merging#Branching and merging|Branching and merging]]).  You can
227later merge the removals to another branch if you want
228(see section [[cvs: Branching and merging#Merging can add or remove files|Merging can add or remove files]]).
229
230
231----
232
233<div id="Removing-directories"></div>
234<table class="header" cellpadding="1" cellspacing="1" border="0">
235<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
236<td valign="middle" align="left">|[[#Removing files| &lt; ]]|</td>
237<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
238<td valign="middle" align="left">|[[#Moving and renaming files| &gt; ]]|</td>
239<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
240<td valign="middle" align="left"> &nbsp; </td>
241<td valign="middle" align="left"> &nbsp; </td>
242<td valign="middle" align="left"> &nbsp; </td>
243<td valign="middle" align="left"> &nbsp; </td>
244<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
245<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
246<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
247<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
248</tr></table>
249<div id="Removing-directories-1"></div>
250=== Removing directories ===
251<div id="index-Removing-directories"></div>
252<div id="index-Directories_002c-removing"></div>
253
254In concept removing directories is somewhat similar to
255removing files&mdash;you want the directory to not exist in
256your current working directories, but you also want to
257be able to retrieve old releases in which the directory
258existed.
259
260The way that you remove a directory is to remove all
261the files in it.  You don&rsquo;t remove the directory
262itself; there is no way to do that.
263Instead you specify the &lsquo;<code>-P</code>&rsquo; option to
264<code>cvs update</code> or <code>cvs checkout</code>,
265which will cause <small>CVS</small> to remove empty
266directories from working directories.
267(Note that <code>cvs export</code> always removes empty directories.)
268Probably the
269best way to do this is to always specify &lsquo;<code>-P</code>&rsquo;; if
270you want an empty directory then put a dummy file (for
271example &lsquo;<tt>.keepme</tt>&rsquo;) in it to prevent &lsquo;<code>-P</code>&rsquo; from
272removing it.
273
274Note that &lsquo;<code>-P</code>&rsquo; is implied by the &lsquo;<code>-r</code>&rsquo; or &lsquo;<code>-D</code>&rsquo;
275options of <code>checkout</code>.  This way
276<small>CVS</small> will be able to correctly create the directory
277or not depending on whether the particular version you
278are checking out contains any files in that directory.
279
280
281----
282
283<div id="Moving-files"></div>
284<table class="header" cellpadding="1" cellspacing="1" border="0">
285<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
286<td valign="middle" align="left">|[[#Removing directories| &lt; ]]|</td>
287<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
288<td valign="middle" align="left">|[[#The Normal way to Rename| &gt; ]]|</td>
289<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
290<td valign="middle" align="left"> &nbsp; </td>
291<td valign="middle" align="left"> &nbsp; </td>
292<td valign="middle" align="left"> &nbsp; </td>
293<td valign="middle" align="left"> &nbsp; </td>
294<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
295<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
296<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
297<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
298</tr></table>
299<div id="Moving-and-renaming-files"></div>
300=== Moving and renaming files ===
301<div id="index-Moving-files"></div>
302<div id="index-Renaming-files"></div>
303<div id="index-Files_002c-moving"></div>
304
305Moving files to a different directory or renaming them
306is not difficult, but some of the ways in which this
307works may be non-obvious.  (Moving or renaming a
308directory is even harder.  See section [[#Moving and renaming directories|Moving and renaming directories]].).
309
310The examples below assume that the file <var>old</var> is renamed to
311<var>new</var>.
312
313<div class="menu-preformatted" style="font-family: serif">
314 [[#The Normal way to Rename|&bull; Outside]]::                     The normal way to Rename
315 [[#Moving the history file|&bull; Inside]]::                      A tricky, alternative way
316 [[#Copying the history file|&bull; Rename by copying]]::           Another tricky, alternative way
317</div>
318
319
320----
321
322<div id="Outside"></div>
323<table class="header" cellpadding="1" cellspacing="1" border="0">
324<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
325<td valign="middle" align="left">|[[#Moving and renaming files| &lt; ]]|</td>
326<td valign="middle" align="left">|[[#Moving and renaming files| Up ]]|</td>
327<td valign="middle" align="left">|[[#Moving the history file| &gt; ]]|</td>
328<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
329<td valign="middle" align="left"> &nbsp; </td>
330<td valign="middle" align="left"> &nbsp; </td>
331<td valign="middle" align="left"> &nbsp; </td>
332<td valign="middle" align="left"> &nbsp; </td>
333<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
334<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
335<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
336<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
337</tr></table>
338<div id="The-Normal-way-to-Rename"></div>
339==== The Normal way to Rename ====
340
341
342The normal way to move a file is to copy <var>old</var> to
343<var>new</var>, and then issue the normal <small>CVS</small> commands
344to remove <var>old</var> from the repository, and add
345<var>new</var> to it.
346
347<div class="example" style="margin-left: 3.2em">
348 $ mv <var>old</var> <var>new</var>
349 $ cvs remove <var>old</var>
350 $ cvs add <var>new</var>
351 $ cvs commit -m &quot;Renamed <var>old</var> to <var>new</var>&quot; <var>old</var> <var>new</var>
352</div>
353
354This is the simplest way to move a file, it is not
355error-prone, and it preserves the history of what was
356done.  Note that to access the history of the file you
357must specify the old or the new name, depending on what
358portion of the history you are accessing.  For example,
359<code>cvs log <var>old</var></code> will give the log up until the
360time of the rename.
361
362When <var>new</var> is committed its revision numbers will
363start again, usually at 1.1, so if that bothers you,
364use the &lsquo;<code>-r rev</code>&rsquo; option to commit.  For more
365information see [[cvs: Revisions#Assigning revisions|Assigning revisions]].
366
367
368----
369
370<div id="Inside"></div>
371<table class="header" cellpadding="1" cellspacing="1" border="0">
372<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
373<td valign="middle" align="left">|[[#The Normal way to Rename| &lt; ]]|</td>
374<td valign="middle" align="left">|[[#Moving and renaming files| Up ]]|</td>
375<td valign="middle" align="left">|[[#Copying the history file| &gt; ]]|</td>
376<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
377<td valign="middle" align="left"> &nbsp; </td>
378<td valign="middle" align="left"> &nbsp; </td>
379<td valign="middle" align="left"> &nbsp; </td>
380<td valign="middle" align="left"> &nbsp; </td>
381<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
382<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
383<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
384<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
385</tr></table>
386<div id="Moving-the-history-file"></div>
387==== Moving the history file ====
388
389This method is more dangerous, since it involves moving
390files inside the repository.  Read this entire section
391before trying it out!
392
393<div class="example" style="margin-left: 3.2em">
394 $ cd $CVSROOT/<var>dir</var>
395 $ mv <var>old</var>,v <var>new</var>,v
396</div>
397
398Advantages:
399
400
401* The log of changes is maintained intact.
402
403
404* The revision numbers are not affected.
405
406Disadvantages:
407
408
409* Old releases cannot easily be fetched from the repository.  (The file will show up as <var>new</var> even in revisions from the time before it was renamed).
410
411
412* There is no log information of when the file was renamed.
413
414
415* Nasty things might happen if someone accesses the history file while you are moving it.  Make sure no one else runs any of the <small>CVS</small> commands while you move it.
416
417
418----
419
420<div id="Rename-by-copying"></div>
421<table class="header" cellpadding="1" cellspacing="1" border="0">
422<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
423<td valign="middle" align="left">|[[#Moving the history file| &lt; ]]|</td>
424<td valign="middle" align="left">|[[#Moving and renaming files| Up ]]|</td>
425<td valign="middle" align="left">|[[#Moving and renaming directories| &gt; ]]|</td>
426<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
427<td valign="middle" align="left"> &nbsp; </td>
428<td valign="middle" align="left"> &nbsp; </td>
429<td valign="middle" align="left"> &nbsp; </td>
430<td valign="middle" align="left"> &nbsp; </td>
431<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
432<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
433<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
434<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
435</tr></table>
436<div id="Copying-the-history-file"></div>
437==== Copying the history file ====
438
439This way also involves direct modifications to the
440repository.  It is safe, but not without drawbacks.
441
442<div class="example" style="margin-left: 3.2em">
443 # <span class="roman" style="font-family:serif; font-weight:normal">Copy the RCS file inside the repository</span>
444 $ cd $CVSROOT/<var>dir</var>
445 $ cp <var>old</var>,v <var>new</var>,v
446 # <span class="roman" style="font-family:serif; font-weight:normal">Remove the old file</span>
447 $ cd ~/<var>dir</var>
448 $ rm <var>old</var>
449 $ cvs remove <var>old</var>
450 $ cvs commit <var>old</var>
451 # <span class="roman" style="font-family:serif; font-weight:normal">Remove all tags from <var>new</var></span>
452 $ cvs update <var>new</var>
453 $ cvs log <var>new</var>             # <span class="roman" style="font-family:serif; font-weight:normal">Remember the non-branch tag names</span>
454 $ cvs tag -d <var>tag1</var> <var>new</var>
455 $ cvs tag -d <var>tag2</var> <var>new</var>
456 &hellip;
457</div>
458
459By removing the tags you will be able to check out old
460revisions.
461
462Advantages:
463
464
465* Checking out old revisions works correctly, as long as you use &lsquo;<code>-r<var>tag</var></code>&rsquo; and not &lsquo;<code>-D<var>date</var></code>&rsquo; to retrieve the revisions.
466
467
468* The log of changes is maintained intact.
469
470
471* The revision numbers are not affected.
472
473Disadvantages:
474
475
476* You cannot easily see the history of the file across the rename.
477
478
479
480----
481
482<div id="Moving-directories"></div>
483<table class="header" cellpadding="1" cellspacing="1" border="0">
484<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
485<td valign="middle" align="left">|[[#Copying the history file| &lt; ]]|</td>
486<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
487<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt; ]]|</td>
488<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
489<td valign="middle" align="left"> &nbsp; </td>
490<td valign="middle" align="left"> &nbsp; </td>
491<td valign="middle" align="left"> &nbsp; </td>
492<td valign="middle" align="left"> &nbsp; </td>
493<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
494<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
495<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
496<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
497</tr></table>
498<div id="Moving-and-renaming-directories"></div>
499=== Moving and renaming directories ===
500<div id="index-Moving-directories"></div>
501<div id="index-Renaming-directories"></div>
502<div id="index-Directories_002c-moving"></div>
503
504The normal way to rename or move a directory is to
505rename or move each file within it as described in
506[[#The Normal way to Rename|The Normal way to Rename]].  Then check out with the &lsquo;<code>-P</code>&rsquo;
507option, as described in [[#Removing directories|Removing directories]].
508
509If you really want to hack the repository to rename or
510delete a directory in the repository, you can do it
511like this:
512
513
514# Inform everyone who has a checked out copy of the directory that the directory will be renamed.  They should commit all their changes, and remove their working copies, before you take the steps below.
515
516
517# Rename the directory inside the repository.
518
519<div class="example" style="margin-left: 3.2em">
520 $ cd $CVSROOT/<var>parent-dir</var>
521 $ mv <var>old-dir</var> <var>new-dir</var>
522</div>
523
524
525# Fix the <small>CVS</small> administrative files, if necessary (for instance if you renamed an entire module).
526
527
528# Tell everyone that they can check out again and continue working.
529
530
531If someone had a working copy the <small>CVS</small> commands will
532cease to work for him, until he removes the directory
533that disappeared inside the repository.
534
535It is almost always better to move the files in the
536directory instead of moving the directory.  If you move the
537directory you are unlikely to be able to retrieve old
538releases correctly, since they probably depend on the
539name of the directories.
540
541
542----
543
544<table class="header" cellpadding="1" cellspacing="1" border="0">
545<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
546<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
547<td valign="middle" align="left"> &nbsp; </td>
548<td valign="middle" align="left"> &nbsp; </td>
549<td valign="middle" align="left"> &nbsp; </td>
550<td valign="middle" align="left"> &nbsp; </td>
551<td valign="middle" align="left"> &nbsp; </td>
552<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
553<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
554<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
555<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
556</tr></table>
557This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
558