Search code examples
gitfacebookgit-workflow

git workflow master vs keeping releases


I want to start working with git workflow so I went ahead and started reading a lot. Including:

I have a few questions regarding it this model:

  1. what is the purpose of the master branch?
    I know it's a production history, but why do I need it if I have the actual release branches?
    What I assume is that the release branches are deleted at some point, so the only history is in the tags on the master.
    Am I correct in thinking that you can either have the master branch and delete all the release branches, or keep the release branches and not have a history branch (as master)?
  2. Assuming we don't have so frequent releases. Is it better to use master approach or keep the branches approach?
  3. I see facebook in react & react-native is using the "keep the branches" approach. why?

Solution

    1. what is the purpose of the master branch?

    It's the branch which is cloned by default, so anyone cloning the repo can start from the last known good production point.
    The release branches are for starting the next release cycle, so old ones can be pruned eventually, as they are meant to be merge into master once a release development cycle is completed.

    1. Assuming we don't have so frequent releases. Is it better to use master approach or keep the branches approach?

    Keeping the branches is preferable, to isolate your next release development cycle in its own branch.

    1. I see facebook in react & react-native is using the "keep the branches" approach. why?

    Because listing the branches makes it easy to explore the history specific to each release. You simply switch to the right branch.