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">
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">
9 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
11 border: 1px solid red;
16 margin: 1em 5% 1em 5%;
21 text-decoration: underline
;
39 h1
, h2
, h3
, h4
, h5
, h6
{
41 font-family: sans-serif
;
48 border-bottom: 2px solid silver
;
66 border: 1px solid silver
;
81 font-family: sans-serif
;
88 font-family: sans-serif
;
92 font-family: sans-serif
;
94 border-top: 2px solid silver
;
100 padding-bottom: 0.5em;
104 padding-bottom: 0.5em;
108 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
109 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
110 div
.admonitionblock
{
113 margin-bottom: 1.5em;
115 div
.admonitionblock
{
117 margin-bottom: 2.5em;
120 div
.content
{ /* Block element content. */
124 /* Block element titles. */
125 div
.title
, caption
.title
{
126 font-family: sans-serif
;
130 margin-bottom: 0.5em;
136 td div
.title:first-child
{
139 div
.content div
.title:first-child
{
142 div
.content
+ div
.title
{
146 div
.sidebarblock
> div
.content
{
148 border: 1px solid silver
;
155 div
.listingblock
> div
.content
{
156 border: 1px solid silver
;
161 div
.quoteblock
> div
.content
{
168 div
.verseblock
+ div
.attribution
{
172 div
.admonitionblock
.icon
{
176 text-decoration: underline
;
178 padding-right: 0.5em;
180 div
.admonitionblock td
.content
{
182 border-left: 2px solid silver
;
185 div
.exampleblock
> div
.content
{
186 border-left: 2px solid silver
;
190 div
.verseblock div
.content
{
194 div
.imageblock div
.content
{ padding-left: 0; }
195 div
.imageblock img
{ border: 1px solid silver
; }
196 span
.image img
{ border-style: none
; }
200 margin-bottom: 0.8em;
212 list-style-position: outside
;
215 list-style-type: lower-alpha
;
218 div
.tableblock
> table
{
219 border: 3px solid
#527bbd;
222 font-family: sans-serif
;
231 margin-bottom: 0.8em;
239 padding-right: 0.8em;
246 div#footer-badges
{ display: none
; }
251 font-family: sans-serif
;
255 margin-bottom: 0.1em;
258 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
274 include1::./stylesheets
/xhtml11-manpage
.css
[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div
.sidebar-content
{
279 border: 1px solid silver
;
282 div
.sidebar-title
, div
.image-title
{
283 font-family: sans-serif
;
286 margin-bottom: 0.5em;
289 div
.listingblock div
.content
{
290 border: 1px solid silver
;
295 div
.quoteblock-content
{
299 div
.exampleblock-content
{
300 border-left: 2px solid silver
;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc
a:visited
{ color: blue
; }
307 <title>gitcvs-migration(
7)
</title>
312 gitcvs-migration(
7) Manual Page
315 <div class=
"sectionbody">
316 <p>gitcvs-migration -
322 <div class=
"sectionbody">
323 <div class=
"para"><p>git cvsimport *
</p></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>
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>
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>
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">
357 <div class=
"title">Note
</div>
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>
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>
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>
386 <div class=
"para"><p>as long as the shared repository does not have any branches
387 other than
<tt>master
</tt>.
</p></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
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>
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>
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>
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
<destination
> <module
></tt></pre>
429 <div class=
"para"><p>This puts a git archive of the named CVS module in the directory
430 <destination
>, 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
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>
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>
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
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>
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>
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>
496 <div id=
"footer-text">
497 Last updated
2010-
09-
18 23:
57:
05 UTC