r/programming • • Jun 19 '15

GitFlow considered harmful

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

244 comments sorted by

View all comments

Show parent comments

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.

0

u/[deleted] Jun 19 '15

[deleted]

12

u/Peaker Jun 19 '15

In git, branches and tags are essentially the same, except tags are supposed to be immutable and not move, whereas branches move.

So it sounds like re-creating a branch starting from that tag is merely a minor inconvenience?

0

u/[deleted] Jun 19 '15

[deleted]

10

u/Peaker Jun 19 '15

If you had a branch, it'd just equal the newest tag.

Tags aren't "inside" branches. Branches and tags are just pointers.

→ More replies (4)

6

u/elperroborrachotoo Jun 19 '15

I don't know what the gitflow fuzz is about, and I prefer to "fix in develop, carry successful fixes to release branch".

Yet I don't see your problem either.

Let me try:

dev  ---> dev ------>  merge --> dev --->
  \-- 1.0 ---> {tag} --/

Oops! Bug in 1.0

dev  ---> dev ------>  merge --> dev --->
  \-- 1.0 ---> {tag} --/
                 \---- 1.1 ---> ...

4

u/ybrs Jun 19 '15
dev  ---> dev ------>  merge --> dev ---------->
  \-- 1.0 ---> {tag} --/                 /
                 \---- 1.1 ---> {tag} --/                          /
                                 \                               /
                                  \---------> 1.2 ---> {tag} --- /

vs.

dev  ---> dev ------>  merge --> dev --------------------->
    \-- 1.0 ------ / --- commit -- / -- commit bugfix -- /

i think what he means is the second one, having a linear branch is far easier to understand and use than having tags and re-creating branches etc.

if i can chime in, if you are developing an application (like an ios application etc) and need to bump version everytime it completely make sense, tags are like snapshots you cant change it, and when you release your software, you cant update without releasing a new version.

on the other hand, if you are building applications on the server side or (maybe web frontend), and deploy a dozen of times everyday, its a nightmare to tag and rebranch.

0

u/[deleted] Jun 19 '15

[deleted]

→ More replies (2)
→ More replies (4)

2

u/skinny85 Jun 19 '15

Yep, that's exactly how it works, and what I explained in the comment above.

→ More replies (4)

2

u/Cwiddy Jun 19 '15

I am not overly familiar with Git other than simple personal use (still in a SVN shop) but just to clarify for myself in get,

  • you can branch

  • do a bunch of things

  • tag the branch?

  • merge to master

  • delete branch.

So my questions are when you delete a branch you tag you still get the history to that tag, that is what you said above I think.

And then when you branch from a tag it has it's full history to that point?

0

u/[deleted] Jun 19 '15

[deleted]

4

u/fireflash38 Jun 19 '15

People are very angry that someone else's workflow is different than their own workflow.

→ More replies (2)
→ More replies (1)

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)