Re: RFC: Migration of the master revision control repository to git

"Patrice Fournier" <[email protected]>
Newsgroups gmane.comp.telephony.fax.hylafax.devel
Message-ID <[email protected]>
Quoting "Tim Rice" <[email protected]>:

> On Wed, 1 Jul 2009, Patrice Fournier wrote:
>
> I can't say I'm in favor of the migration (after all, it will be more work
> for me to learn yet another version control program) but I certainly will
> not stand in the way of it. What would help me is some good pointers to
> how to use git.
> And more specificly, how to duplicate the things I do with CVS now.

I found http://git.or.cz/course/svn.html to be a good starting point  
when migrating to git. (SVN and CVS being quite similar, it should be  
useful for you as well.) There is also a CVS Crash Course on that  
site, but it uses Cogito as a front end which I never used and can't  
comment on.

http://www.kernel.org/pub/software/scm/git/docs/everyday.html is  
another page with useful information.

There are multiples ways to do everything in git, the following  
examples are not the only solutions to your questions. ;)

> Say I wanted to check out HEAD to a directory named hylafax,
> with CVS I would
> cvs -z9 -d [email protected]:/usr/local/cvsroot co -d hylafax hylafax
>
> Then to pull updates for HEAD
> cvs -z9 -d [email protected]:/usr/local/cvsroot update -d hylafax
>
> or check out the 6.0 branch to a directoty named hylafax-6.0 would
> be
> cvs -z9 -d [email protected]:/usr/local/cvsroot update -r  
> HYLAFAX-6_0-branch -d hylafax-6.0
>
> and to pull updates for the 6.0 branch
> cvs -z9 -d [email protected]:/usr/local/cvsroot co -r  
> HYLAFAX-6_0-branch -d hylafax-6.0 hylafax
>
> How do I do those things with git?

Note that git saves a complete copy of the repository on the local  
machine, so a clone or update will (by default) do it for every heads  
(branches).

To work on the master branch (CVS HEAD):

git clone ssh://[email protected]:/path/to/hylafax.git hylafax
git pull (from within the working tree)

"git fetch origin" (or "git remote update" to update all remotes) can  
also be used to update the local repository, but not the working tree.

To work on HYLAFAX-6.0:

You can create a local branch from within your current HylaFAX git  
working tree like this (using the current CVS branch names):

git checkout -b hylafax-6.0 HYLAFAX-6_0_branch

"git checkout master" would return your working tree to the main head  
(CVS HEAD). There is no network activity involved in this as you have  
the whole repository on your local disk.

Your public working repository (if you want one) would be at  
"ssh://[email protected]/~/public_git/hylafax" for you and at  
"git://git.hylafax.org/~tim/hylafax" for public read.

> Then there is commiting
> Say I wanted to commit defs.in in HEAD, I would
> cvs -d [email protected]:/usr/local/cvsroot commit hylafax/defs.in
>
> or to the 6.0 branch
> cvs -d [email protected]:/usr/local/cvsroot commit -r  
> HYLAFAX-6_0-branch hylafax-6.0/defs.in
>
> How is that done with git?

When the right head (branch) is checked out, from within the working tree:

git add defs.in
git commit defs.in (or "git commit" to commit every changes recorded  
by "git add", "git rm", ...)

This last commit created the commit on your local repository, you can  
later push them to the central repository when you are ready by using:

git push origin master
or
git push origin HYLAFAX-6_0-branch

You can also push them to your public_git repository first for  
external review.

git push public_git master:new_branch (of course, you will generally  
want to create a working branch to make your changes to be reviewed  
first, so it would more likely look like:)

git checkout -b new_branch master
git add file
git commit
[...]
git push public_git new_branch

> Then what about adding files?
> If I wanted to add the files hylafax/faxcover/edit-faxcover.sh.in and
> hylafax/man/edit-faxcover.1 I would use a script something like
> .......
> HERE=`pwd`
> FILES_ADD="hylafax/faxcover/edit-faxcover.sh.in hylafax/man/edit-faxcover.1"
> for i in $FILES_ADD
> do
> 	cd `dirname $i`
> 	cvs -d [email protected]:/usr/local/cvsroot add `basename ${i}`
> 	cd $HERE
> done
> .......
>
> How is that done with git?

git add faxcover/edit-faxcover.sh.in man/edit-faxcover.1

> Thanks for any tips you may have.

Let us know if you need anymore.


-- 
Patrice Fournier
iFAX Solutions, Inc.
www.ifax.com


____________________ HylaFAX(tm) Developers Mailing List ____________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
On UNIX: mail -s unsubscribe [email protected] < /dev/null
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.