Felix Geisendörfer - Git and CakePHP

Written by Mark Story on Tue, Dec 2nd 2008, 14:16

Felix is a huge git fan and Git is a source version control application. It is a command line tool, and there are not many gui tools. Git has a few advantages, it is easier to integrate with other tools. Git also doesn't require a server, allowing you to work locally. Unlike svn there is only one .git folder and it contains the entire project history.

Configuring git

Before using git you should configure git with git config. You should configure your user name, user email and ui.color. Once you have configured git you are ready to go.

Making Commits

By using git add you can add single files, folders, whole trees. You then can use git commit to create a commit and add a commit message.

You cannot store empty folders in git. If you have any empty folders you need to put an 'empty' file in the folders.

Show Plain Text
find . -type f | grep -v empty | xargs git rm

Felix used the above to clear all the temp files but leave the empty files. This will let you add the tmp directory structure to the git repo and still keep the directories clean.

The importance of SHA1 hashes

All objects in git are identified by SHA1. The SHA1 is used to identify commits, trees, and blobs. I also found it interesting that unlike SVN a git repo is very transparent. The commit SHA1's are actually the filenames in the repo. Although the contents of these files are compressed its nice to know there are files to look at instead of a pile of scary binary blobs.

Using .gitignore

.gitignore can be used to ignore files or paths. You should add files based on absolute paths from your project root. Normally with a cake setup you want to ignore app/tmp as well as your database.php. At this point Felix's excitement for git had to come to an end. His hour was up but I got the feeling that at least a few people had their interest in git increased.

With the first day of CakeFest Argentina at a close I'm looking forward to the rest of the talks as today was an excellent start to what is shaping up to a great festival.


CakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHP CakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHP