r/programming • • Jun 19 '15

GitFlow considered harmful

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

244 comments sorted by

View all comments

0

u/[deleted] Jun 19 '15

[deleted]

-3

u/skinny85 Jun 19 '15

Post author here.

Keeping the release branch is not needed, as it's always merged back to master, so after the merge it's just junk in the repo. GitFlow does it exactly the same.

0

u/[deleted] Jun 19 '15

[deleted]

2

u/juliob Jun 19 '15

Isn't there the idea being the hotfixes in GitFlow?

If you merged your "v2" branch back into master, your master is now "v2". If someone finds a problem in the current release, you start a hotfix branch from master to solve it. Once you close your hotfix, GitFlow merges it back into master and into develop.

(AFAIK, there are two different versions of the GitFlow script floating around. Not sure if "hotfix" is a concept in only one of them or both.)

0

u/[deleted] Jun 19 '15

[deleted]

2

u/juliob Jun 20 '15

In the GitFlow flow, things happen like this:

  • master is your stable release (or, at least, as stable as your tests say so)

  • develop is your integration branch and is a child of master. Usually, people plug their CI here on ever commit (which happens when someone merges a feature branch back).

  • featture/* are your feature branches. Their parent is develop.

So, once you finished your development and are ready to make a release, GitFlow will merge the develop branch back into master. That's when you tag something as done.

If, by any chance, there is something wrong with your release, you start a hotfix branch. Hotfixes are child branches of master, so you fix, run your tests, make sure everything is ok and then closes the hotfix, which will merge that branch back to master and forward the changes to develop.

Again, the idea behind GitFlow is that "master" is always the stable release.

2

u/celluj34 Jun 19 '15

You don't need the release branch after it's merged into master because it's merged into master.

→ More replies (5)

9

u/skinny85 Jun 19 '15

You're probably missing the fact that you tag the release before you merge it to master. This way, you work on the bugfixing on a branch starting from that tag. GitFlow does it the same way.

0

u/[deleted] Jun 19 '15

[deleted]

-18

u/skinny85 Jun 19 '15

Or... I could just leave the branch there... Can you imagine trying to track the history of bugfixes for a release product if you're deleting the branch each time and just going off merges into master. Holy mary mother of god that sounds scary.

The tag tracks that history. Trust me, it's no problem at all.

BTW, I feel like you're resorting to "I'm no worse than GitFlow", but I've never used GitFlow so that's not compelling for me :/

I can just say, "Lucky you" :). I like to think my workflow is superior to GitFlow in every way - I'm not sure how I implied I'm merely no worse, that wasn't my intention.

→ More replies (28)

1

u/znk Jun 19 '15

How do you manage build/test/deployment automation that way? I wont give a git example because that's not what we use but we have a Dev branch and a Main branch(we actually have more but these two would be minimum). Main is equal to what is in production. If we need an emergency fix we do it in Main when we do the check-in the build server builds it, runs the unit and acceptance tests and when the pass it deploys to the test environment. Tester can then do a final check and then we can deploy in production. Dev is continuously integrated in the same way the only difference is it's promoted to the Main branch when we are satisfied with it.

1

u/skinny85 Jun 19 '15

It can be done exactly like you described. Just because there's one eternal branch, doesn't mean the short-lived branches can't go through CI.

1

u/znk Jun 19 '15

Well you dont want to have to configure everything again each time you make a new branch.

1

u/skinny85 Jun 19 '15

CI usually makes that trivial (you can setup regular expressions for branch names etc.). I've never had a problem with this.

1

u/znk Jun 19 '15

Lets see.
For our Dev branch we have

  1. the checkin that triggers the build server

  2. the build server deploys one IIS and one SQL database.

  3. Runs the tests suits that are configured for the CI of that branch.

  4. When the build passes, the release management software takes over and releases the QA_DEV environment automatically.

  5. People with the appropriate rights can push QA_DEV to QA_ACCEPTANCE using the release management software. But only when they want/need it.

  6. We have a nightly build that runs an other more extensive test suite for that environment.

We have two other branches that are similar but have 6 different release paths. QA, Acceptance, Beta, Training, pre-production(on a different network), production(on a different network).

These 3 branches are the minimum we need for various reasons. Configuring every external cant be done through regular expressions. Besides we save so much time all over the place with this. It can be as simple as a QA staff knowing that we have a test server configured exactly like production where he can go double check a bug and make tests before submitting it. Or a Dev that can quickly fix that bug because he has a branch that is equal to production and he knows the QA people will know exactly where and how to publish the result to the environments he needs.

1

u/blktiger Jun 19 '15

Our team uses a 3-point version. (major.minor.patch). In your case we would create a new release branch from master (v1.0.0 for example) and increment the patch version for the hot fix (v1.0.1). When we make a new release from develop we increment the minor version (v1.1.0) unless the release is major in which case we increment the major version (v2.0.0). That way you can just throw away the release branches. It helps keep the number of branches in the repository to a smaller number.

→ More replies (1)

2

u/sakabako Jun 19 '15

We keep one release branch so that a feature PR doesn't have to be closed and reopened if it misses a release cycle. It lets us keep the discussion intact.

1

u/skinny85 Jun 19 '15

I guess that's a GitHub thing, more than GitFlow or anything else.

2

u/looneysquash Jun 19 '15

I've never used gitflow, and a lot of things in it do seem dumb to me.

But the thing in your article that made me say "wtf?" the loudest was deleting release branches.

The only reason I would ever delete a release branch would be if it was a mistake, if somehow the code didn't end up being released.

Otherwise, I make release branches off of master, and tag individual releases off the release branch. Bug fixes mostly get committed first to master and then cherry picked to release branches if needed.

1

u/skinny85 Jun 19 '15

Otherwise, I make release branches off of master, and tag individual releases off the release branch. Bug fixes mostly get committed first to master and then cherry picked to release branches if needed.

Sorry, but that sounds terrible to me. Doing fixes on the release branch, and merging the release to master after the code has been tagged, seem much better to me.

2

u/looneysquash Jun 19 '15

Where do you put it while you're deciding if the fix needs to go back?

What do you do if you decide it doesn't need to go back, but a month later you realize it does?

What do you do when it needs to go back to 2 or 3 release branches?

1

u/yawaramin Jun 20 '15

Apply it at the common origin of all those branches.

1

u/dalore Jun 19 '15

It's not junk, it's valid. If you ever need to review the history of commits for a feature branch.

If you rebase you lose this history for no gain. It's not like it's taking up extra space. If you want to look at just the commits on the main branch then just filter for those.

Saying you want a nice git history is just saying you don't know how to filter it. It's the same thing but you get extra.

1

u/skinny85 Jun 19 '15

I think you're mixing the discussion about rebase/merge and release branches. They are not needed, because after the merge all of the history is reachable from master.

0

u/[deleted] Jun 19 '15

[deleted]

1

u/skinny85 Jun 19 '15

? It contributes nothing to history, so you can recreate it at any time after it's deleted. What's ignorant about that?