git

Using Git to deploy code changes..

Submitted by fago on Tue, 03/30/2010 - 12:14
Wouldn't it be nice have your changes up and running at a development site just by pushing it there with git push dev? Well with Git that's pretty easy to achieve. First create a new Git repository on the remote if you haven't yet:
mkdir www
cd www
git init
Then push your code to this repository initially and then check it out:
git checkout your-branch
So now we need to make Git automatically checking out the latest code once you pushed it in. For that create the script ".git/hooks/post-receive":
#!/bin/sh
cd ..
export GIT_DIR=".git"
git checkout -f
And don't forget to make the file executable. Now as the code is automatically updated, we need to disable the usual warning when one pushes to a remote repository with a checkout:
git config receive.denycurrentbranch ignore
That's it. Simple and useful, not? :) Credits go to http://toroid.org/ams/git-website-howto, which I used to come up with this.

About using git to maintain a drupal module...

Submitted by fago on Wed, 01/06/2010 - 21:50
Some months ago I gave git a first try for developing some stacked core patches. I quickly get used to it and to its nice features (german). Luckily its SVN integration is really nice and simple to use so GIT is even a fine replacement for the usual SVN client. Unfortunately for CVS things are much worse.. :( Poor cvs!

First tries..

I decided to don't go back to CVS for maintaining drupal modules. First I tried using the public GIT mirror of the whole drupal CVS from the French drupal community, however I quickly noted that it was broken for the rules module, so I tried to set up my on mirror. I started using Sam Boyer's scripts, however I had some misc small troubles with them, but more important those scripts copy the whole drupal CVS - but I didn't like to waste ~6 gigs of disk space and the time to sync all the unneeded stuff. So I ended writing my own script based on the instructions in the drupal handbook for maintaining a module with git and Sam's script. After some weeks going back and forth I finally ended up with something useful, so here are my experiences:

What is it about?

Currently I've set the script up to export the drupal CVS of some of my modules to GIT - its automatically pushing to my github account, which is quite convenient. It syncs only the really needed modules using rsync - which is an important step as its greatly speeding up cvsps when exporting from CVS. The nice thing is that it doesn't overwrite any changes not yet in CVS, so I can use the same git repository on github to develop new stuff and export to CVS later on.