For some time I was trying to get in touch with git but haven’t got any project to really use it. That is, one I could convert from CVS or SVN and don’t have the other group members hit me.
Having a needed patch to the LambdaMOO server make it a really interesting candidate.
We are going to extract all the versions of the server from Sourceforge to create a local git repository and then browse around it.
Installation of the needed packages
Let’s go right away to the packages we will need. Start by the base for git.
$ sudo apt-get install git-core
Then the cvs related package. There is a git tutorial that tells you to also install CVSps.
sudo apt-get install cvs cvsps
I though this was enough but mindo from MOOsaico warned me I would need just another one
sudo apt-get install git-cvs
Now we have all the ingredients to cook what we want.
Importing from the CVS repository
Let’s fetch the repository from sourceforge. We will use the following command template
git cvsimport -C
making a directory “destination” with the repository from the CVS “module”.
When asked for a password just press enter.
$ cvs -d:pserver:[email protected]:/cvsroot/lambdamoo login
$ git cvsimport -d:pserver:[email protected]:/cvsroot/lambdamoo -C server-git server
Initialized empty Git repository in /home/paf/src/lambdamoo/server-git/.git/
Counting objects: 1395, done.
Compressing objects: 100% (1393/1393), done.
Writing objects: 100% (1395/1395), done.
Total 1395 (delta 1077), reused 0 (delta 0)
This make take several minutes. Just wait.
cd server-git
gitk
Enjoy now the graphically ((Instead of gitk you may prefer giggle: sudo apt-get install giggle
)) view of the revisions.
Adding a branch
Creating a branch is really difficult in git: you will have to use the … branch command :-)
To make a branch named iconv
type
$ git branch iconv
$ git branch
AUTOCONF_TWO
CONSTANTS
FLOATSUSPEND
INLINEPC
PARC
UNSAFE_OPTS
WAIF
WROGUE
iconv
* master
origin
And you can also see all the existent branches.
But to do some work you must change your context to your branch
$ git checkout iconv
Switched to branch "iconv"
Then edit, add, remove files. ((Don’t forget to use the add
command and check the git tutorial to learn more.))
Don’t forget to save your changes in the repository and afterwards if you want switch back to the master branch.
$ git commit -a
$ git checkout master
To play a bit more check melo’s Git starters post.