Written by Mark on December 2, 2008

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.

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.


Other Articles

CakePHP 2 Application Cookbook
Written by James on August 11, 2014

CakeDC Git Workflow - Working Together
Written by Lubomir on July 31, 2014

Users plugin 2.1.0 released
Written by Florian on July 8, 2014

CakePHP 3.0 is coming
Written by Larry on June 28, 2014

CakeDC Git Workflow - Tips and Tricks
Written by Lubomir on June 24, 2014

Comments plugin 1.3.0 released
Written by Florian on June 17, 2014

The annual CakePHP conference
Written by James on June 12, 2014

Tags plugin 1.6.0 released
Written by Florian on June 4, 2014

CakeDC Git Workflow - An Introduction
Written by Lubomir on May 31, 2014

Search plugin 2.3.0 released
Written by Florian on May 23, 2014

CakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHP CakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHPCakePHP