/dev/null

The personal blog of Michael Mayer.

May 4, 2011

Git: A hellish nightmare!

Tags: , , , , — 17:52

Even though I am the master of procrastination, I managed to fix 3 issues in flot (JS charting plugin for jQuery) and PHPUnit this week. Of course they are hosted on github and everyone who knows me, knows that I hate git because it is sooo different from svn and my brain frequently explodes when I see all the branches and connections between them. Every time I try to explain that to more or less experienced git users, they try to convince me from the opposite. Anyhow, it shouldn’t be a mission impossible to checkout the source, fix the bugs and send pull request – one for each fix – to the maintainers, right?

After committing the second flot fix, I found out that you can only send ONE pull request per branch and I didn’t even know how to create new branches. Not to speak about how to move the commits to the right branches. Without the help of Alexandre Salomé from Sensio Labs I would have been totally lost! Here is what he did:

git status
git checkout origin/master -b fix-fonts
git remote
git remote -v
git checkout upstream/master -b tmp
git branch -D fix-fonts
git checkout -b fix-fonts
git branch -D tmp
git log
git cherry-pick 82583fc
git cherry-pick 082e991
git push origin fix-typos
git push origin fix-fonts
git checkout 40d886f9
git checkout -b fix-issue-520
git push origin fix-issue-520
git checkout origin/master
git checkout upstream/master
git branch -D master
git checkout -b master
git push -f origin master

Simple, isn’t it?

I really have to read (and understand) a book about git soon.

Powered by PHP, Memcached, Suhosin, MySQL and WordPress