THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

207 lines
7.6KB

  1. gitcvs-migration(7)
  2. ===================
  3. NAME
  4. ----
  5. gitcvs-migration - Git for CVS users
  6. SYNOPSIS
  7. --------
  8. [verse]
  9. 'git cvsimport' *
  10. DESCRIPTION
  11. -----------
  12. Git differs from CVS in that every working tree contains a repository with
  13. a full copy of the project history, and no repository is inherently more
  14. important than any other. However, you can emulate the CVS model by
  15. designating a single shared repository which people can synchronize with;
  16. this document explains how to do that.
  17. Some basic familiarity with Git is required. Having gone through
  18. linkgit:gittutorial[7] and
  19. linkgit:gitglossary[7] should be sufficient.
  20. Developing against a shared repository
  21. --------------------------------------
  22. Suppose a shared repository is set up in /pub/repo.git on the host
  23. foo.com. Then as an individual committer you can clone the shared
  24. repository over ssh with:
  25. ------------------------------------------------
  26. $ git clone foo.com:/pub/repo.git/ my-project
  27. $ cd my-project
  28. ------------------------------------------------
  29. and hack away. The equivalent of 'cvs update' is
  30. ------------------------------------------------
  31. $ git pull origin
  32. ------------------------------------------------
  33. which merges in any work that others might have done since the clone
  34. operation. If there are uncommitted changes in your working tree, commit
  35. them first before running git pull.
  36. [NOTE]
  37. ================================
  38. The 'pull' command knows where to get updates from because of certain
  39. configuration variables that were set by the first 'git clone'
  40. command; see `git config -l` and the linkgit:git-config[1] man
  41. page for details.
  42. ================================
  43. You can update the shared repository with your changes by first committing
  44. your changes, and then using the 'git push' command:
  45. ------------------------------------------------
  46. $ git push origin master
  47. ------------------------------------------------
  48. to "push" those commits to the shared repository. If someone else has
  49. updated the repository more recently, 'git push', like 'cvs commit', will
  50. complain, in which case you must pull any changes before attempting the
  51. push again.
  52. In the 'git push' command above we specify the name of the remote branch
  53. to update (`master`). If we leave that out, 'git push' tries to update
  54. any branches in the remote repository that have the same name as a branch
  55. in the local repository. So the last 'push' can be done with either of:
  56. ------------
  57. $ git push origin
  58. $ git push foo.com:/pub/project.git/
  59. ------------
  60. as long as the shared repository does not have any branches
  61. other than `master`.
  62. Setting Up a Shared Repository
  63. ------------------------------
  64. We assume you have already created a Git repository for your project,
  65. possibly created from scratch or from a tarball (see
  66. linkgit:gittutorial[7]), or imported from an already existing CVS
  67. repository (see the next section).
  68. Assume your existing repo is at /home/alice/myproject. Create a new "bare"
  69. repository (a repository without a working tree) and fetch your project into
  70. it:
  71. ------------------------------------------------
  72. $ mkdir /pub/my-repo.git
  73. $ cd /pub/my-repo.git
  74. $ git --bare init --shared
  75. $ git --bare fetch /home/alice/myproject master:master
  76. ------------------------------------------------
  77. Next, give every team member read/write access to this repository. One
  78. easy way to do this is to give all the team members ssh access to the
  79. machine where the repository is hosted. If you don't want to give them a
  80. full shell on the machine, there is a restricted shell which only allows
  81. users to do Git pushes and pulls; see linkgit:git-shell[1].
  82. Put all the committers in the same group, and make the repository
  83. writable by that group:
  84. ------------------------------------------------
  85. $ chgrp -R $group /pub/my-repo.git
  86. ------------------------------------------------
  87. Make sure committers have a umask of at most 027, so that the directories
  88. they create are writable and searchable by other group members.
  89. Importing a CVS archive
  90. -----------------------
  91. NOTE: These instructions use the `git-cvsimport` script which ships with
  92. git, but other importers may provide better results. See the note in
  93. linkgit:git-cvsimport[1] for other options.
  94. First, install version 2.1 or higher of cvsps from
  95. https://github.com/andreyvit/cvsps[https://github.com/andreyvit/cvsps] and make
  96. sure it is in your path. Then cd to a checked out CVS working directory
  97. of the project you are interested in and run linkgit:git-cvsimport[1]:
  98. -------------------------------------------
  99. $ git cvsimport -C <destination> <module>
  100. -------------------------------------------
  101. This puts a Git archive of the named CVS module in the directory
  102. <destination>, which will be created if necessary.
  103. The import checks out from CVS every revision of every file. Reportedly
  104. cvsimport can average some twenty revisions per second, so for a
  105. medium-sized project this should not take more than a couple of minutes.
  106. Larger projects or remote repositories may take longer.
  107. The main trunk is stored in the Git branch named `origin`, and additional
  108. CVS branches are stored in Git branches with the same names. The most
  109. recent version of the main trunk is also left checked out on the `master`
  110. branch, so you can start adding your own changes right away.
  111. The import is incremental, so if you call it again next month it will
  112. fetch any CVS updates that have been made in the meantime. For this to
  113. work, you must not modify the imported branches; instead, create new
  114. branches for your own changes, and merge in the imported branches as
  115. necessary.
  116. If you want a shared repository, you will need to make a bare clone
  117. of the imported directory, as described above. Then treat the imported
  118. directory as another development clone for purposes of merging
  119. incremental imports.
  120. Advanced Shared Repository Management
  121. -------------------------------------
  122. Git allows you to specify scripts called "hooks" to be run at certain
  123. points. You can use these, for example, to send all commits to the shared
  124. repository to a mailing list. See linkgit:githooks[5].
  125. You can enforce finer grained permissions using update hooks. See
  126. link:howto/update-hook-example.html[Controlling access to branches using
  127. update hooks].
  128. Providing CVS Access to a Git Repository
  129. ----------------------------------------
  130. It is also possible to provide true CVS access to a Git repository, so
  131. that developers can still use CVS; see linkgit:git-cvsserver[1] for
  132. details.
  133. Alternative Development Models
  134. ------------------------------
  135. CVS users are accustomed to giving a group of developers commit access to
  136. a common repository. As we've seen, this is also possible with Git.
  137. However, the distributed nature of Git allows other development models,
  138. and you may want to first consider whether one of them might be a better
  139. fit for your project.
  140. For example, you can choose a single person to maintain the project's
  141. primary public repository. Other developers then clone this repository
  142. and each work in their own clone. When they have a series of changes that
  143. they're happy with, they ask the maintainer to pull from the branch
  144. containing the changes. The maintainer reviews their changes and pulls
  145. them into the primary repository, which other developers pull from as
  146. necessary to stay coordinated. The Linux kernel and other projects use
  147. variants of this model.
  148. With a small group, developers may just pull changes from each other's
  149. repositories without the need for a central maintainer.
  150. SEE ALSO
  151. --------
  152. linkgit:gittutorial[7],
  153. linkgit:gittutorial-2[7],
  154. linkgit:gitcore-tutorial[7],
  155. linkgit:gitglossary[7],
  156. linkgit:giteveryday[7],
  157. link:user-manual.html[The Git User's Manual]
  158. GIT
  159. ---
  160. Part of the linkgit:git[1] suite