In my experience, the first thing you need to define before choosing a workflow for the git
is what your release cycle.
The best model for your case depends on a main variable:
The code that is in production is continuously changed with new
Features as soon as they are ready (rolling release), or there is a
practice of incorporating all the new Features and bugfixes into one package
closed and release this for production (Fixed release)?
Note that in both cases it is crucial that new branches are created from the branch where they will be embedded at the end of the process. No intermediaries.
Rolling releases
This phallic model uses a less structured flow like the Github Flow.
Having 2 main branches master
and develop
, All Ports are based on master
. When they are ready they are incorporated into develop
for approval, and after release to Feature is incorporated into master
and released for production.
In this model develop
is never incorporated into master
and often you delete develop
and recreates from master
when that branch gets "dirty" with changes that have never been approved and will not be incorporated. Many companies prefer to call the develop
of staging
in this case, to avoid confusion.
Fixed releases
In this case a more structured process is worth, as the Git Flow, illustrated in Diogo’s reply.
In this process, the main branches master
and develop
serve purposes other than the previous flow. master
is what you’re running now, and develop
is your next full release, that is, you know that that code is stable and is just waiting to complete the cycle to incorporate whole the develop
in master
. Then it makes sense that new branches are created from develop
for developers to work on stable code most current.
In this process you often have other test branches, for example a staging
where the test takes place before Feature goes to develop
and the important thing is that at the beginning of each cycle, develop
and master
are strictly equal.
Related: How version nomenclature works for private or public projects?, What is the difference between a branch and a tag? and When incrementing the version using Semantic Versioning?
– Guilherme Nascimento