This is a suggested approach that uses the advantages of multiple branching to assign it to the multi-stage development process, combining the advantages they offer.

Multi-branching

  • Master - contains production code. All development code is merged into master when it is ready.
  • Staging - this branch contains pre-production or development code, when the features are finished then they are merged here.

During the development cycle, a variety of supporting branches are used:

  • Feature-* - feature branches are used to develop new features for the upcoming releases.
  • Hotfix-* - hotfix branches are necessary to act immediately upon an undesired status of master or staging.

Some advantages of this approach are:

Development Phases

Using the previous multi-branch scheme, it can be used to separate it into local, staging and production environments as it can be seen in the previous image

Multi-branching for Multi-stage

Features and hotfixes branches for local environment

Staging branch for testing on the cloud before production

Master branch for production

Local Environment

Staging Environment

Production Environment

References

4 branching workflows for Git
The Benefits of Using Staging Environments in WordPress Development
What Is A Staging Site?