Recent comments

In Benchmarking requestAction
David wrote: Why you are not counting database connection impact? Is it really so unimportant?
In Nate Abele - PHP is dying
Victor wrote: When you say the following: "[PHP] is just too simple. It requires only a few lines to generate...
In Felix Geisendörfer - Git and CakePHP
Josh wrote: I'd really like to figure out a way to clone the official git repo and merge it with my own in a...
In Martin Radosta - Record level security based on SQL
markstory wrote: Well the article was about a talk that Martin Radosta gave. I have not written this behavior. ...
In Martin Radosta - Record level security based on SQL
skitle wrote: Was curious if the files for this are available? I have searched through the SF site, and have...
RSS Feed for comments

Felix Geisendörfer - Git and CakePHP

Written on Tue, Dec 2nd 2008, 14:16 in ,

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.

Back to Mark's articles

Comments:

Add New Comment

  • I'd really like to figure out a way to clone the official git repo and merge it with my own in a method that would make 'updating' my project(s) with the latest cakephp revision quick and painless. As it stands, upgrading is rather manual. Any tips/ideas?

    Reply | Josh | posted on 28/4/09

openID

What is OpenID?

OpenID is a new open standard that lets you sign in to web sites with a single URL that you own. This URL can be your homepage or blog, or it can be provided to you by a web site you use. In either case, you only have to sign in once to your OpenID provider and so you only need to maintain a single password.Learn more.

How is CakeDC using OpenID?

You can use your OpenID identity when posting comments on the site. When you see a form field with OpenID logo entering your OpenID identity is sufficient to allow your post. We also accept Google or Yahoo! identities. Simply use either "google.com" or "yahoo.com" and our OpenID library will locate your information from the appropriate source.