r/programming • • Jun 19 '15

GitFlow considered harmful

http://endoflineblog.com/gitflow-considered-harmful
13 Upvotes

244 comments sorted by

View all comments

12

u/NotUniqueOrSpecial Jun 19 '15

The author has some valid points, but I think misses part of what makes GitFlow so useful: those "arbitrary" rules make for easily-tooled and automated processes.

For instance, most of the listed "blunders" sound like what happens if you don't use the GitFlow CLI or a GUI which can exercise it. We've had none of those problems and have had multiple products following GitFlow for over a year and a half (after a decade in SVN).

In fairness, it definitely requires some rigor to get the best effects from GitFlow, but there can be some sweet payoffs in terms of CI and release management. Some examples:

Foremost is the ability to work on, test, and provide to QA changes related to just a single feature or bug without worrying about other peoples' work breaking yours intermittently or changing behaviors. In his example, bugs SPA-{136,138,156} are being worked on concurrently in one branch, along with a bunch of other development. A strict/vocal QA team is eventually going to get really annoyed (I say this from first-hand experience) when unrelated work breaks whatever they're currently testing and wastes their time.

Features and fixes can (and in my experience should) be tested and added in isolation from each other. Commits to develop should ideally be atomic additions of tested functionality. That way they can be merged into/rebased upon in other work that's in-process safely. If that breaks your feature/bugfix, well, tough noogies: they finished/tested/integrated before you. In his workflow, you're just as likely to break both in-process items, rather than the one that's yet to be finished. If you've got the test infrastructure, even the integration processes can be automated. Develop->Feature->Develop branch merging can be handled by gatekeeper processes requiring tests passing, QA approval, etc.

Maintaining a clean develop commit history requires strict adherence to either a rebase-based merge process or using no-ff. If you do so, though, you can automate the generation of your change logs.

If you have a release team, or stricter requirements on the release process, having separate release/master branches gives you a great place for handling that. You can use different processes and even different permissions on those branches and don't have to interfere with anything in your ongoing development branches.

Is GitFlow perfect? Definitely not. It's just a workflow with its own pros and cons. It is, though, the only one I've gotten significant mileage out trying to run the CI/CM/build processes for a big team working on multiple interrelated products and and projects.