{"id":4104,"date":"2022-12-20T17:39:24","date_gmt":"2022-12-20T20:39:24","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/gitcvsmigration-man7\/"},"modified":"2022-12-20T17:39:24","modified_gmt":"2022-12-20T20:39:24","slug":"gitcvsmigration-man7","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/gitcvsmigration-man7\/","title":{"rendered":"GITCVS&minus;MIGRATION (man7)"},"content":{"rendered":"<h1 align=\"center\">GITCVS\u2212MIGRATION<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#DEVELOPING AGAINST A SHARED REPOSITORY\">DEVELOPING AGAINST A SHARED REPOSITORY<\/a><br \/> <a href=\"#SETTING UP A SHARED REPOSITORY\">SETTING UP A SHARED REPOSITORY<\/a><br \/> <a href=\"#IMPORTING A CVS ARCHIVE\">IMPORTING A CVS ARCHIVE<\/a><br \/> <a href=\"#ADVANCED SHARED REPOSITORY MANAGEMENT\">ADVANCED SHARED REPOSITORY MANAGEMENT<\/a><br \/> <a href=\"#PROVIDING CVS ACCESS TO A GIT REPOSITORY\">PROVIDING CVS ACCESS TO A GIT REPOSITORY<\/a><br \/> <a href=\"#ALTERNATIVE DEVELOPMENT MODELS\">ALTERNATIVE DEVELOPMENT MODELS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#GIT\">GIT<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">gitcvs-migration \u2212 Git for CVS users<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>git cvsimport<\/i> *<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Git differs from CVS in that every working tree contains a repository with a full copy of the project history, and no repository is inherently more important than any other. However, you can emulate the CVS model by designating a single shared repository which people can synchronize with; this document explains how to do that.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Some basic familiarity with Git is required. Having gone through <b>gittutorial<\/b>(7) and <b>gitglossary<\/b>(7) should be sufficient.<\/p>\n<h2>DEVELOPING AGAINST A SHARED REPOSITORY <a name=\"DEVELOPING AGAINST A SHARED REPOSITORY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Suppose a shared repository is set up in \/pub\/repo.git on the host foo.com. Then as an individual committer you can clone the shared repository over ssh with:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$ git clone foo.com:\/pub\/repo.git\/ my\u2212project <br \/> $ cd my\u2212project<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">and hack away. The equivalent of <i>cvs update<\/i> is<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$ git pull origin<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">which merges in any work that others might have done since the clone operation. If there are uncommitted changes in your working tree, commit them first before running git pull.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><b><big>Note<\/big><\/b> <br \/> The <i>pull<\/i> command knows where to get updates from because of certain configuration variables that were set by the first <i>git clone<\/i> command; see <b>git config \u2212l<\/b> and the <b>git-config<\/b>(1) man page for details.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">You can update the shared repository with your changes by first committing your changes, and then using the <i>git push<\/i> command:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$ git push origin master<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">to &#8220;push&#8221; those commits to the shared repository. If someone else has updated the repository more recently, <i>git push<\/i>, like <i>cvs commit<\/i>, will complain, in which case you must pull any changes before attempting the push again.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the <i>git push<\/i> command above we specify the name of the remote branch to update (<b>master<\/b>). If we leave that out, <i>git push<\/i> tries to update any branches in the remote repository that have the same name as a branch in the local repository. So the last <i>push<\/i> can be done with either of:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">$ git push origin <br \/> $ git push foo.com:\/pub\/project.git\/<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">as long as the shared repository does not have any branches other than <b>master<\/b>.<\/p>\n<h2>SETTING UP A SHARED REPOSITORY <a name=\"SETTING UP A SHARED REPOSITORY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>We assume you have already created a Git repository for your project, possibly created from scratch or from a tarball (see <b>gittutorial<\/b>(7)), or imported from an already existing CVS repository (see the next section).<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>Assume your existing repo is at \/home\/alice\/myproject. Create a new &#8220;bare&#8221; repository (a repository without a working tree) and fetch your project into it:<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>$ mkdir \/pub\/my\u2212repo.git <br \/> $ cd \/pub\/my\u2212repo.git <br \/> $ git \u2212\u2212bare init \u2212\u2212shared <br \/> $ git \u2212\u2212bare fetch \/home\/alice\/myproject master:master<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>Next, give every team member read\/write access to this repository. One easy way to do this is to give all the team members ssh access to the machine where the repository is hosted. If you don\u2019t want to give them a full shell on the machine, there is a restricted shell which only allows users to do Git pushes and pulls; see <b>git-shell<\/b>(1).<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>Put all the committers in the same group, and make the repository writable by that group:<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>$ chgrp \u2212R $group \/pub\/my\u2212repo.git<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>Make sure committers have a umask of at most 027, so that the directories they create are writable and searchable by other group members.<\/big><\/p>\n<h2>IMPORTING A CVS ARCHIVE <a name=\"IMPORTING A CVS ARCHIVE\"><\/a> <\/h2>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><b><big>Note<\/big><\/b> <br \/> These instructions use the <b>git\u2212cvsimport<\/b> script which ships with git, but other importers may provide better results. See the note in <b>git-cvsimport<\/b>(1) for other options.<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big>First, install version 2.1 or higher of cvsps from <b><font color=\"#0000FF\">https:\/\/github.com\/andreyvit\/cvsps<\/font><\/b> <font color=\"#000000\">and make sure it is in your path. Then cd to a checked out CVS working directory of the project you are interested in and run <b>git-cvsimport<\/b>(1):<\/font><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><font color=\"#000000\">$ git cvsimport \u2212C <destination> <module><\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\">This puts a Git archive of the named CVS module in the directory <destination>, which will be created if necessary.<\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\">The import checks out from CVS every revision of every file. Reportedly cvsimport can average some twenty revisions per second, so for a medium\u2212sized project this should not take more than a couple of minutes. Larger projects or remote repositories may take longer.<\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\">The main trunk is stored in the Git branch named <b>origin<\/b>, and additional CVS branches are stored in Git branches with the same names. The most recent version of the main trunk is also left checked out on the <b>master<\/b> branch, so you can start adding your own changes right away.<\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\">The import is incremental, so if you call it again next month it will fetch any CVS updates that have been made in the meantime. For this to work, you must not modify the imported branches; instead, create new branches for your own changes, and merge in the imported branches as necessary.<\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\">If you want a shared repository, you will need to make a bare clone of the imported directory, as described above. Then treat the imported directory as another development clone for purposes of merging incremental imports.<\/font><\/big><\/p>\n<h2>ADVANCED SHARED REPOSITORY MANAGEMENT <a name=\"ADVANCED SHARED REPOSITORY MANAGEMENT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big>Git allows you to specify scripts called &#8220;hooks&#8221; to be run at certain points. You can use these, for example, to send all commits to the shared repository to a mailing list. See <b>githooks<\/b>(5).<\/big><\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big>You can enforce finer grained permissions using update hooks. See<\/big><\/font> <big><b><font color=\"#0000FF\">Controlling access to branches using update hooks<\/font><\/b><\/big> <font color=\"#000000\">[1] <big>.<\/big><\/font><\/big><\/p>\n<h2>PROVIDING CVS ACCESS TO A GIT REPOSITORY <a name=\"PROVIDING CVS ACCESS TO A GIT REPOSITORY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big>It is also possible to provide true CVS access to a Git repository, so that developers can still use CVS; see <b>git-cvsserver<\/b>(1) for details.<\/big><\/font><\/big><\/p>\n<h2>ALTERNATIVE DEVELOPMENT MODELS <a name=\"ALTERNATIVE DEVELOPMENT MODELS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big>CVS users are accustomed to giving a group of developers commit access to a common repository. As we\u2019ve seen, this is also possible with Git. However, the distributed nature of Git allows other development models, and you may want to first consider whether one of them might be a better fit for your project.<\/big><\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big>For example, you can choose a single person to maintain the project\u2019s primary public repository. Other developers then clone this repository and each work in their own clone. When they have a series of changes that they\u2019re happy with, they ask the maintainer to pull from the branch containing the changes. The maintainer reviews their changes and pulls them into the primary repository, which other developers pull from as necessary to stay coordinated. The Linux kernel and other projects use variants of this model.<\/big><\/font><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big>With a small group, developers may just pull changes from each other\u2019s repositories without the need for a central maintainer.<\/big><\/font><\/big><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big><b>gittutorial<\/b>(7), <b>gittutorial-2<\/b>(7), <b>gitcore-tutorial<\/b>(7), <b>gitglossary<\/b>(7), <b>giteveryday<\/b>(7),<\/big><\/font> <big><b><font color=\"#0000FF\">The Git User\u2019s Manual<\/font><\/b><\/big> <font color=\"#000000\">[2]<\/font><\/big><\/p>\n<h2>GIT <a name=\"GIT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><font color=\"#000000\"><big>Part of the <b>git<\/b>(1) suite<\/big><\/font><\/big><\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><big><font color=\"#000000\"><big>1.<\/big><\/font><\/big><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"75%\">\n<p style=\"margin-top: 1em\"><big><font color=\"#000000\"><big>Controlling access to branches using update hooks<\/big><\/font><\/big><\/p>\n<\/td>\n<td width=\"8%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><big><font color=\"#000000\"><big>file:\/\/\/usr\/share\/doc\/git-doc\/howto\/update-hook-example.html<\/big><\/font><\/big><\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"12%\"><\/td>\n<td width=\"3%\">\n<p style=\"margin-top: 1em\"><big><font color=\"#000000\"><big>2.<\/big><\/font><\/big><\/p>\n<\/td>\n<td width=\"2%\"><\/td>\n<td width=\"32%\">\n<p style=\"margin-top: 1em\"><big><font color=\"#000000\"><big>The Git User\u2019s Manual<\/big><\/font><\/big><\/p>\n<\/td>\n<td width=\"51%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\"><big><font color=\"#000000\"><big>file:\/\/\/usr\/share\/doc\/git-doc\/user-manual.html<\/big><\/font><\/big><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  gitcvs-migration \u2212 Git for CVS users <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[971],"tags":[973,1183,972],"class_list":["post-4104","post","type-post","status-publish","format-standard","hentry","category-7-miscelanea","tag-973","tag-gitcvs-migration","tag-man7"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4104"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4104\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}