Autogenerated HTML docs for v1.7.4-rc2
[git/jnareb-git.git] / gitcvs-migration.html
blob15f601070d2eac861eec800efc39ea29769f64b3
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6 <meta name="generator" content="AsciiDoc 8.2.5" />
7 <style type="text/css">
8 /* Debug borders */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
47 h1, h2, h3 {
48 border-bottom: 2px solid silver;
50 h2 {
51 padding-top: 0.5em;
53 h3 {
54 float: left;
56 h3 + * {
57 clear: left;
60 div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
65 hr {
66 border: 1px solid silver;
69 p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
74 pre {
75 padding: 0;
76 margin: 0;
79 span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
85 span#email {
87 span#revision {
88 font-family: sans-serif;
91 div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
98 div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
102 div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
107 div#preamble,
108 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110 div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
115 div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
120 div.content { /* Block element content. */
121 padding: 0;
124 /* Block element titles. */
125 div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
132 div.title + * {
133 margin-top: 0;
136 td div.title:first-child {
137 margin-top: 0.0em;
139 div.content div.title:first-child {
140 margin-top: 0.0em;
142 div.content + div.title {
143 margin-top: 0.0em;
146 div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
152 div.listingblock {
153 margin-right: 0%;
155 div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
161 div.quoteblock > div.content {
162 padding-left: 2.0em;
165 div.attribution {
166 text-align: right;
168 div.verseblock + div.attribution {
169 text-align: left;
172 div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
180 div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
185 div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
190 div.verseblock div.content {
191 white-space: pre;
194 div.imageblock div.content { padding-left: 0; }
195 div.imageblock img { border: 1px solid silver; }
196 span.image img { border-style: none; }
198 dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
202 dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
207 dd > *:first-child {
208 margin-top: 0;
211 ul, ol {
212 list-style-position: outside;
214 div.olist2 ol {
215 list-style-type: lower-alpha;
218 div.tableblock > table {
219 border: 3px solid #527bbd;
221 thead {
222 font-family: sans-serif;
223 font-weight: bold;
225 tfoot {
226 font-weight: bold;
229 div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
233 div.hlist td {
234 padding-bottom: 5px;
236 td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
241 td.hlist2 {
242 vertical-align: top;
245 @media print {
246 div#footer-badges { display: none; }
249 div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
258 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
262 div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
266 div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
270 div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
274 include1::./stylesheets/xhtml11-manpage.css[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
282 div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
289 div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
295 div.quoteblock-content {
296 padding-left: 2.0em;
299 div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc a:visited { color: blue; }
306 </style>
307 <title>gitcvs-migration(7)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 gitcvs-migration(7) Manual Page
313 </h1>
314 <h2>NAME</h2>
315 <div class="sectionbody">
316 <p>gitcvs-migration -
317 git for CVS users
318 </p>
319 </div>
320 </div>
321 <h2>SYNOPSIS</h2>
322 <div class="sectionbody">
323 <div class="para"><p>git cvsimport *</p></div>
324 </div>
325 <h2 id="_description">DESCRIPTION</h2>
326 <div class="sectionbody">
327 <div class="para"><p>Git differs from CVS in that every working tree contains a repository with
328 a full copy of the project history, and no repository is inherently more
329 important than any other. However, you can emulate the CVS model by
330 designating a single shared repository which people can synchronize with;
331 this document explains how to do that.</p></div>
332 <div class="para"><p>Some basic familiarity with git is required. Having gone through
333 <a href="gittutorial.html">gittutorial(7)</a> and
334 <a href="gitglossary.html">gitglossary(7)</a> should be sufficient.</p></div>
335 </div>
336 <h2 id="_developing_against_a_shared_repository">Developing against a shared repository</h2>
337 <div class="sectionbody">
338 <div class="para"><p>Suppose a shared repository is set up in /pub/repo.git on the host
339 foo.com. Then as an individual committer you can clone the shared
340 repository over ssh with:</p></div>
341 <div class="listingblock">
342 <div class="content">
343 <pre><tt>$ git clone foo.com:/pub/repo.git/ my-project
344 $ cd my-project</tt></pre>
345 </div></div>
346 <div class="para"><p>and hack away. The equivalent of <em>cvs update</em> is</p></div>
347 <div class="listingblock">
348 <div class="content">
349 <pre><tt>$ git pull origin</tt></pre>
350 </div></div>
351 <div class="para"><p>which merges in any work that others might have done since the clone
352 operation. If there are uncommitted changes in your working tree, commit
353 them first before running git pull.</p></div>
354 <div class="admonitionblock">
355 <table><tr>
356 <td class="icon">
357 <div class="title">Note</div>
358 </td>
359 <td class="content">
360 <div class="para"><p>The <em>pull</em> command knows where to get updates from because of certain
361 configuration variables that were set by the first <em>git clone</em>
362 command; see <tt>git config -l</tt> and the <a href="git-config.html">git-config(1)</a> man
363 page for details.</p></div>
364 </td>
365 </tr></table>
366 </div>
367 <div class="para"><p>You can update the shared repository with your changes by first committing
368 your changes, and then using the <em>git push</em> command:</p></div>
369 <div class="listingblock">
370 <div class="content">
371 <pre><tt>$ git push origin master</tt></pre>
372 </div></div>
373 <div class="para"><p>to "push" those commits to the shared repository. If someone else has
374 updated the repository more recently, <em>git push</em>, like <em>cvs commit</em>, will
375 complain, in which case you must pull any changes before attempting the
376 push again.</p></div>
377 <div class="para"><p>In the <em>git push</em> command above we specify the name of the remote branch
378 to update (<tt>master</tt>). If we leave that out, <em>git push</em> tries to update
379 any branches in the remote repository that have the same name as a branch
380 in the local repository. So the last <em>push</em> can be done with either of:</p></div>
381 <div class="listingblock">
382 <div class="content">
383 <pre><tt>$ git push origin
384 $ git push foo.com:/pub/project.git/</tt></pre>
385 </div></div>
386 <div class="para"><p>as long as the shared repository does not have any branches
387 other than <tt>master</tt>.</p></div>
388 </div>
389 <h2 id="_setting_up_a_shared_repository">Setting Up a Shared Repository</h2>
390 <div class="sectionbody">
391 <div class="para"><p>We assume you have already created a git repository for your project,
392 possibly created from scratch or from a tarball (see
393 <a href="gittutorial.html">gittutorial(7)</a>), or imported from an already existing CVS
394 repository (see the next section).</p></div>
395 <div class="para"><p>Assume your existing repo is at /home/alice/myproject. Create a new "bare"
396 repository (a repository without a working tree) and fetch your project into
397 it:</p></div>
398 <div class="listingblock">
399 <div class="content">
400 <pre><tt>$ mkdir /pub/my-repo.git
401 $ cd /pub/my-repo.git
402 $ git --bare init --shared
403 $ git --bare fetch /home/alice/myproject master:master</tt></pre>
404 </div></div>
405 <div class="para"><p>Next, give every team member read/write access to this repository. One
406 easy way to do this is to give all the team members ssh access to the
407 machine where the repository is hosted. If you don't want to give them a
408 full shell on the machine, there is a restricted shell which only allows
409 users to do git pushes and pulls; see <a href="git-shell.html">git-shell(1)</a>.</p></div>
410 <div class="para"><p>Put all the committers in the same group, and make the repository
411 writable by that group:</p></div>
412 <div class="listingblock">
413 <div class="content">
414 <pre><tt>$ chgrp -R $group /pub/my-repo.git</tt></pre>
415 </div></div>
416 <div class="para"><p>Make sure committers have a umask of at most 027, so that the directories
417 they create are writable and searchable by other group members.</p></div>
418 </div>
419 <h2 id="_importing_a_cvs_archive">Importing a CVS archive</h2>
420 <div class="sectionbody">
421 <div class="para"><p>First, install version 2.1 or higher of cvsps from
422 <a href="http://www.cobite.com/cvsps/">http://www.cobite.com/cvsps/</a> and make
423 sure it is in your path. Then cd to a checked out CVS working directory
424 of the project you are interested in and run <a href="git-cvsimport.html">git-cvsimport(1)</a>:</p></div>
425 <div class="listingblock">
426 <div class="content">
427 <pre><tt>$ git cvsimport -C &lt;destination&gt; &lt;module&gt;</tt></pre>
428 </div></div>
429 <div class="para"><p>This puts a git archive of the named CVS module in the directory
430 &lt;destination&gt;, which will be created if necessary.</p></div>
431 <div class="para"><p>The import checks out from CVS every revision of every file. Reportedly
432 cvsimport can average some twenty revisions per second, so for a
433 medium-sized project this should not take more than a couple of minutes.
434 Larger projects or remote repositories may take longer.</p></div>
435 <div class="para"><p>The main trunk is stored in the git branch named <tt>origin</tt>, and additional
436 CVS branches are stored in git branches with the same names. The most
437 recent version of the main trunk is also left checked out on the <tt>master</tt>
438 branch, so you can start adding your own changes right away.</p></div>
439 <div class="para"><p>The import is incremental, so if you call it again next month it will
440 fetch any CVS updates that have been made in the meantime. For this to
441 work, you must not modify the imported branches; instead, create new
442 branches for your own changes, and merge in the imported branches as
443 necessary.</p></div>
444 <div class="para"><p>If you want a shared repository, you will need to make a bare clone
445 of the imported directory, as described above. Then treat the imported
446 directory as another development clone for purposes of merging
447 incremental imports.</p></div>
448 </div>
449 <h2 id="_advanced_shared_repository_management">Advanced Shared Repository Management</h2>
450 <div class="sectionbody">
451 <div class="para"><p>Git allows you to specify scripts called "hooks" to be run at certain
452 points. You can use these, for example, to send all commits to the shared
453 repository to a mailing list. See <a href="githooks.html">githooks(5)</a>.</p></div>
454 <div class="para"><p>You can enforce finer grained permissions using update hooks. See
455 <a href="howto/update-hook-example.txt">Controlling access to branches using
456 update hooks</a>.</p></div>
457 </div>
458 <h2 id="_providing_cvs_access_to_a_git_repository">Providing CVS Access to a git Repository</h2>
459 <div class="sectionbody">
460 <div class="para"><p>It is also possible to provide true CVS access to a git repository, so
461 that developers can still use CVS; see <a href="git-cvsserver.html">git-cvsserver(1)</a> for
462 details.</p></div>
463 </div>
464 <h2 id="_alternative_development_models">Alternative Development Models</h2>
465 <div class="sectionbody">
466 <div class="para"><p>CVS users are accustomed to giving a group of developers commit access to
467 a common repository. As we've seen, this is also possible with git.
468 However, the distributed nature of git allows other development models,
469 and you may want to first consider whether one of them might be a better
470 fit for your project.</p></div>
471 <div class="para"><p>For example, you can choose a single person to maintain the project's
472 primary public repository. Other developers then clone this repository
473 and each work in their own clone. When they have a series of changes that
474 they're happy with, they ask the maintainer to pull from the branch
475 containing the changes. The maintainer reviews their changes and pulls
476 them into the primary repository, which other developers pull from as
477 necessary to stay coordinated. The Linux kernel and other projects use
478 variants of this model.</p></div>
479 <div class="para"><p>With a small group, developers may just pull changes from each other's
480 repositories without the need for a central maintainer.</p></div>
481 </div>
482 <h2 id="_see_also">SEE ALSO</h2>
483 <div class="sectionbody">
484 <div class="para"><p><a href="gittutorial.html">gittutorial(7)</a>,
485 <a href="gittutorial-2.html">gittutorial-2(7)</a>,
486 <a href="gitcore-tutorial.html">gitcore-tutorial(7)</a>,
487 <a href="gitglossary.html">gitglossary(7)</a>,
488 <a href="everyday.html">Everyday Git</a>,
489 <a href="user-manual.html">The Git User's Manual</a></p></div>
490 </div>
491 <h2 id="_git">GIT</h2>
492 <div class="sectionbody">
493 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite.</p></div>
494 </div>
495 <div id="footer">
496 <div id="footer-text">
497 Last updated 2010-09-18 23:57:05 UTC
498 </div>
499 </div>
500 </body>
501 </html>