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.

CakePHP 2 Application Cookbook

CakePHP 2 Application Cookbook

If you are a CakePHP developer looking to ease the burden of development, then this book is for you. As a headfirst dive into the framework, this collection of recipes will help you get the most out of CakePHP, and get your applications baked in no time. Even if you're not familiar with the framework, we'll take you from basic CRUD building to useful solutions that will aid in getting the job done quickly and efficiently.

Other Articles

CakePHP Facebook login using CakeDC Users Plugin
Written by Jorge on October 2, 2015

CakeDC Users Plugin for CakePHP 3
Written by Jorge on September 23, 2015

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

Contact Me