For a few months now, i develop "GRead", a Google Reader client written in python + Qt, for use on the Nokia n900, but with the help of PyQt, works also on any desktop.

It's my first complete project, open-source, and managed by Git, on GitHub.

But i come from Subversion and although i know that git is really powerful and that i can easily manage branches with it, i used to have the same workflow than with Subversion : a linear one.

I mainly work in the master branch, with some developments done in a specific branch but finally merged in the master without nothing in the master during this time.

It was a "subversion applied to git" way of doing things.

And then i saw a git presentation in Paris and the orator spoked about "git-flow".

I was interested in this and i read some stuff about git-flow and decided to apply it to all of my future projects. And on my current main one, GRead

I won't tell you why and how git-flow is great. Just how to transform an linear flow to a git-flow one.

Here is the graph of my repository before :

And after :

For transform my graph i wrote a bash script (it took me lot of hours, i just started too learn git !) which will do everything. It will create master and develop branches, and a branch for each feature or hotfix you specify in the script, and for each tag you want, a release branch.

Launch the script it locally, in the directory of a clone of your repository, and all the magic will apply. It can takes a long time to finish. For me it was 150 commits. The more branches and the more commits you have, the longer it will take to run.

Be careful, some times the script will ask your attention, in several cases :

  • a cherry-pick cannot be applied. Simply ignore it if it's from a merge (read the message just above the alert)
  • an existing branch will be duplicated, you should answer "Y" to continue for this branch (else the branch is ignored)

You can find the script "linear-git-to-git-flow.sh", on GitHub, heavily commented. Just read comments in the first part to know how to use it.

PS : i know that this script can surely be better. But notice that i just started to really use Git... i you have any suggestion i will be happy to enhance this script with your help