6

Reading the gitflow model, it seems to me that the master branch is there only to provide a branch where to store stable versions. What does that add to just tagging develop with the stable versions?

5
  • I've already found an issue with just tagging develop: hotfixes. Hmm, still curious about other pitfalls.
    – Shoe
    Commented Jan 14, 2016 at 5:41
  • gitflow also assumes there is an integration phase in the release-* branches, and that work might evolve for some until it becomes a stable release while the develop branch has progress further in the mean time. Simple tagging wouldn’t allow you to capture that. Commented Jan 15, 2016 at 12:46
  • @HugoFerreira How so? If you were to simply remove master from the gitflow model, then the release branches would still be there and develop would still continue. And once release is joined back to develop, it can be tagged as the new version.
    – Shoe
    Commented Jan 15, 2016 at 13:02
  • well, the tag would have to be in the release-* branch (which are not meant to be long lived branches) to accurately point to the actually release code, and not in the develop branch because you might have added new commits to develop in the meantime. The image in the link is a bit erroneous because it doesn't illustrate that, while you're doing the release, other devs might be committing to develop. Commented Jan 15, 2016 at 16:00
  • @HugoFerreira Oh I see.
    – Shoe
    Commented Jan 15, 2016 at 21:28

2 Answers 2

6

It is similar to the question "Why do we say 'today', instead of 'the day that started the last time the clock went from 23:59 to 00:00'?"

Having the concept of "latest stable" codified in a branch rather than something you have to search for simplifies things.

Whenever you need the latest stable version of the code, you check out the master branch. If you only use tags to mark stable versions, you'd need to first find out what the latest version was so you can check out the correct tag.

You can also feed it into your production line; any time a commit is made to the master branch, that triggers a build and deployment of your product.

You could do all those things without a master-branch; without any branches or tags at all. But it is easier with them, and the whole point of git-flow is to make things easier. Easier to know what you should do, what others do and to communicate about those doings.

0

Not quite/completely. But you’re not far off.

Sure, it does give a stable name to the tip of the state of production. But the “release” process is so incredibly rigid that you hardly gain any information from the branch itself:

  • Every commit to master is a true merge from some other branch
  • Every commit to master is tagged
  • Every commit to master is a new production release by definition (italics in original)

master has become so bubble-wrapped that you can clearly make out what master is even if it was to turn invisible.

So what do you gain? You get an effective alias for the latest release tag. Okay. Is that hard to remember, or to look up? Since all commits to master are true merges (--no-ff) you also get to navigate back to previous versions from each commit on master by following the first parent. (What for?) Another thing you gain is that you can easily see what the previous versions were named. But your versions were probably some appropriately boring monotonically increasing things, so I don’t see what you will learn from that.

You also gain this:

Therefore, each time when changes are merged back into master, this is a new production release by definition. We tend to be very strict at this, so that theoretically, we could use a Git hook script to automatically build and roll-out our software to our production servers everytime there was a commit on master.

For the price of all that ceremony, you gain the ability to indirectly push a “deploy” button by committing to a branch instead of pushing the “deploy” button directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.