How often do you see the following?
commit abcdefg123456789
Merge: 1234567 abcdefg
Author: Joe Disco <joe@wearstightpants.com>
Date: Wed Aug 4 11:16:24 2010 +0100
Merge branch 'master' of git@github.com:levent/meaningoflife into master
I see this common workflow in most teams and my guess is that yours could be similar?
git pull [write some code] git add git commit git push # rejected as somedoucheinspiring individual has decided to push to origin/master in the meantime git pull # introduce the shitty merge commit git push # you've pushed your commit plus the shitty merge making you a douche [everyone hates you as much as you hate them]
Eventually the whole repository is cluttered with meaningless commits.
I generally work in a temporary local branch if my work is likely to take some time (say longer than a pomodoro - 25 mins) and avoid this issue by constantly keeping master up to date through git rebase.
Occassionaly I don’t feel the need (or I forget) to create a feature branch so I work on master (or whatever is your team’s main commit branch).
I have modified my personal workflow to avoid merge commits as follows but it feels slightly ridiculous. There must be an easier way?
Over-the-top workflow:
git pull [write some code] git add git commit git push # rejected but you remain calm this time git checkout -b sometemporarybranch # move your commits over to a temporary branch git checkout master git reset --hard origin/master git pull origin master git checkout sometemporarybranch git rebase master git checkout master git merge sometemporarybranch git push git branch -D sometemporarybranch [high fives all around]
This works for me but feels long-winded and my guess is there is a far simpler way of doing this with git 1.7.x.
Who knows how?
Thanks to Paul Battley @threedaymonk and Andy Roberts @baob this can all be accomplished as follows:
[write some code] [commit code locally] git fetch git rebase origin/master git push
Thanks to Craig Webster @craigwebster and Mutwin Kraus @mutle this can even be shortened to:
[write some code] [commit code locally] git pull --rebase
see the comments for more info and gotchas
Levent Ali · 4 August 2010 · git scm code
I recently decided that it was about time I separate my portfolio work from the amount of other rubbish I store on my flickr account.
There’s still much curation that needs to be done, which is something I struggle with, but hopefully the set will evolve into something I can be proud of over the next few weeks and months.
So without further ado, I hope you enjoy my portfolio of portraits.
Levent Ali · 2 May 2010 · photography
Recently I’ve been using the Sleep Cycle alarm clock iPhone application. The app uses the iPhone’s accelerometer to analyse your sleep and wake you up when you are in a light sleep phase (near your specified alarm time).
This morning I noticed some amusing patterns based on my state prior to going to bed.
It’s worth noting that I have a broken clavicle so I do not move too much whilst resting.

Speaks for itself and most of my graphs look like this.
I was in a lot of pain one evening so took the prescription medication before retiring.

Out cold!
It was a friend’s 30th birthday last night so I had a few alcoholic beverages.

I woke up lying on my broken side with the duvet lying on the floor.
Levent Ali · 18 March 2010 · personal sleep charts
Serenade me with Whitney Houston’s “How Will I Know” and I’m yours.
Levent Ali · 17 February 2010 · music
After months of O2 broadband woes I decided to leave. Their final attempt at resolution was to reduce my bandwidth to such a low level that dropped connections became rare (a couple of times a day as opposed to several times a minute whilst at 8Mb). Of course they lied about this and I was still paying for 8Mb.
After years of dissatisfation with O2’s mobile phone network coverage I decided to request my PAC Code and return to my old operator.
Joke is on me?
Levent Ali · 17 February 2010 · customer service