top | item 6437983

A successful Git branching model (2010)

61 points| dutchbrit | 12 years ago |nvie.com

15 comments

order
[+] sonnym|12 years ago|reply
Over time, I have come to feel this git workflow is more of an attempt to coerce git into a workflow that is familiar to users coming from subversion, rather than learning and understanding git's strengths. A corollary problems is that it mixes development workflow with release management - two disparate concerns that should be handled separately.

After a couple years of using this model, I have done away with using a develop or release branches whatsoever. Develop everything in feature branches, based on either the most recent production tag or the master branch, depending on if it is a hotfix or if it is new development work. A lot of people do not seem to understand you can just checkout a tag, so you do not need to keep a number of hotfix branches around for in-house repositories.

Now, it would be nice to develop a better tagging strategy for rolling updates to a web application, but, for the time being, simply using a stage and production tag work well enough. This is certainly suboptimal and can cause problems, and I cannot recommend doing so. Instead, use production and stage tags with either sane version numbers or simple timestamps. It would be best to only promote from staging to production, but that is not exactly necessary. Most of my thoughts on the release management side of things comes from Alex at The Daily WTF [1].

1. http://thedailywtf.com/Articles/Release-Management-Done-Righ...

[+] dustingetz|12 years ago|reply
umm, how big is your codebase?

The OP describes more or less the way Linux uses git.

[+] kstop|12 years ago|reply
Article mentions wanting to disable fast-forward merges. This should do it (in newer versions of git):

$ git config --global --add merge.ff false

[+] Alan01252|12 years ago|reply
We've just started using this where I'm currently working, and it definitely makes a lot of sense.

There's a command line tool which helps you keep to this branching model. Available here.

https://github.com/nvie/gitflow

Unfortunately it seems to of been abandoned by the author. A more active fork is available here

https://github.com/petervanderdoes/gitflow

Note that if installing on Ubuntu using apt, you'll get the no longer maintained version.

This cheat sheet helped me get up and flowing fast.

http://danielkummer.github.io/git-flow-cheatsheet/

[+] Aldo_MX|12 years ago|reply
I have tried gitflow in the past... too much for my needs, I only need the feature/hotfix branches and the master branch.
[+] programminggeek|12 years ago|reply
I'm pretty sure git flow has been posted to HN many times. How is this on the front page?
[+] ianstallings|12 years ago|reply
Agreed. Might as well mention the tool while we're here: https://github.com/nvie/gitflow

I did just enter a shop where git is new to a lot of people. Kind of blew my mind but I've been in startup land for years and just came back to enterprise development.

[+] dutchbrit|12 years ago|reply
I'm still happy I posted this however, the comments on this subject inside this thread so far are pretty useful.
[+] ams6110|12 years ago|reply
Quite honestly, that workflow looks just as complicated as anything I've seen with svn.
[+] jlgreco|12 years ago|reply
The idea isn't to be simpler than SVN, the idea is to be more flexible than SVN.

I don't follow 'git flow', but git is flexible enough to allow you to develop your own style. Nothing is pressed on you.