Categories
symfony

Using git for symfony projects

Hi,

If you finally decided to use version control software for your current symfony project this small article is for you. We use git and want to share some information about it with you.

So first of all you’ll have to install it:

1. wget http://kernel.org/pub/software/scm/git/git-1.6.4.1.tar.gz (of course number of version most probably will be changed so use git-x.x.x.x.tar.gz)
2. tar xzf git-1.6.4.1.tar.gz
3. ./configure
4. make
5. make install

Please use the following use(r)ful sources about git to know what to do with it now:

http://www.kernel.org/pub/software/scm/git/docs/everyday.html
http://www.spheredev.org/wiki/Git_for_the_lazy#Start_your_project
http://progit.org/book/
http://www.ibm.com/developerworks/web/library/wa-git/index.html
http://www.ibm.com/developerworks/web/library/l-git-subversion-1/index.html

Now b/c of you use it for symfony project you’d have to use the following simple script which we found in other article (please see here for full source):

I forgot numerous time to do a “./symfony clear:cache” after a “git pull”. Here is 2 easy steps to do it automatically:

Step 1: Create a file .git/hooks/post-merge which contains:

#!/bin/sh
#
# An example hook script that is called after a git pull is made
# To enable this hook, make this file executable.

# simply do a ./symfony cc after each git-pull
exec “$GIT_DIR”/../symfony cc

Step 2:Then make it executable

chmod +x .git/hooks/post-merge

When you do a git-pull, it will do a “./symfony cc”

And here are some other sources regarding using of git with symfony projects:

http://iamgraham.net/blog/sane-pre-commit-hooks-for-symfony-git
http://shout.setfive.com/2009/03/22/git-ignores-and-symfony/

Have a fun!

5 replies on “Using git for symfony projects”

What I’d like to know is how you handle the non-existant externals definitions of Subversion in git?

That’s probably the one thing that’s still holding me back to use git in Symfony projects.

Thanks for the great article! 🙂 Cheers, Daniel

I have the problem that empty directories can’t be committed. How do you deal with it?

Leave a Reply

Your email address will not be published. Required fields are marked *