Contact Us

QuickThought: Solving the unknown problem

Posted on 19/5/08 by Felix Geisendörfer

Solving a known problem is great. Solving a problem nobody even knew they had until they see your solution is ingenious.

I'm playing around with git right now (while I really should be working on this). Besides doing a ton of cool stuff, it helps me with something I never even realized was a major PITA: The lack of cheap branches in svn.

A lot of times I'm working on a new feature for an application (and have a therefore unstable working copy) and suddenly a client / other developer wants me to fix some bug or look into an issue he has. Well normally I've done things as ridiculous as copy & pasting the contents of the files I modified in temporary files, reverted the changes and then checked out the problem only to quickly undo my revert minutes later.

With git this is what I do:

$ git commit -m "Interruptions suck less with git"
$ git checkout master
Switched to branch "master"
$ git checkout -b john.bug
Switched to a new branch "john.bug"
$ git checkout newfeature
Switched to branch "newfeature"

And voila I created a completely isolated branch called 'john.bug' based on the current repository master (trunk) branch without having to sacrifice my work in the 'newfeature' branch. Oh and the fact that I can do a million commits in any branch without them ever showing up in the master branch after merging with 'git merge --squash newfeature' is just amazing.

The best way to get started with git is to use it with your current subversion repository. I currently do all my work on the cakephp core using git, allowing me to do big refactorings in several (local) commits without anybody ever seeing them.


You can skip to the end and add a comment.

Dardo Sordi  said on May 19, 2008:

Hi Felix, I'm glad to hear you are experimenting with the coolest SCM out there.

Please don't miss git-stash (my favorite), git-rebase --interactive and git add --patch

Tarique Sani said on May 19, 2008:

git is the coolest thing next to baked bread - err... baked cake ;) Using git locally makes a lot of things easier when you have a long running project. The Eclipse plugin for git is a bit buggy right now but works.

Neil Crookes said on May 19, 2008:

Hi Felix,
I've heard alot about this git thing, I think I'll have to check it out. I recently blogged about "Managing feature additions and bug fixes with Subversion" here:


Felix Geisendörfer said on May 19, 2008:

Dardo: Didn't know about stash - its great, already used it a couple times now ; p.

kabturek said on May 20, 2008:

Great thing that people are picking up GIT :) It's an awesome vcs.
So when can we expect to see http://github/cakephp/cakephp ? ;)

releod said on Jun 11, 2008:

I am hoping onto the GIT bandwagon as well, so far it has been quite impressive.
Personally, I would love to see CakePHP moved over to a GITHUB repo.

Does anyone have a good solution to pulling the latest CakePHP branch as an svn:external - only using GIT instead, that would effectively convert my workflow 100% to GIT from SVN.

wioota said on Jun 22, 2008:

What are the limitations with using 'svn switch' for the same end? Generally switching between branches is painless with subversion in my experience.

Anectdotally (after reading various posts about GIT), GIT sounds like it makes integration straightforward by allowing developers to integrate just what they need but I am not sure why it would be stronger in this scenario over the inbuilt functionality in subversion.

GIT does seem to have a steeper learning curve when trying to unleash its full functionality set as it has so many commands when compared to subversion.

That said, GIT does appeal to me though as the decentralised design does seem to lend itself well to managing different branches of the same software of differing levels of stability.

This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.