Skip to content

Instantly share code, notes, and snippets.

@ricog
Last active December 18, 2015 15:58
Show Gist options
  • Save ricog/5807794 to your computer and use it in GitHub Desktop.
Save ricog/5807794 to your computer and use it in GitHub Desktop.
Deployment workflow

Below is a branching strategy using rebase that maintains a deployable master branch and stable staging branch for quality assurance testing.

###Branch Concepts

  • master - always deployable to production
  • staging - stable code base ready for pre-production testing, also the feature branch merge target
  • features - one branch per feature, testable in development environments, only merged to staging once stable and ready to deploy
  • patches - one branch per patch, urgent items that need applied to master branch ahead of staging and feature branches

Feature branches are agressively rebased on the staging branch by the feature developer. After completed, tested, and signed off (by at least one other developer), the feature branch is merged into staging for final testing. Patch/fix branches are derived from master and rebased if necessary before merging back in.

Start with Master and Staging at same commit

M/S

Developers create feature branches from Staging

    ----f1
  /
M/S

    ----f1
  /
M/S
  \
    ---------f2

Completed features are rebased on Staging and then merged in

   ----f1
 /
M------------S/f2

Patches are created as a new branch from Master

   ----f1
 /
M-----------S/f2
 \
   -----------------p1

Completed patches are rebased on master if needed and then merged in

   ----f1
 /
-------------------M/p1
 \
   --------S/f2

Staging is then rebased on master again

   ----f1
 /
----------------------M/p1----S/f2

Another completed feature is rebased on Staging

                                  ----f1
                                /
----------------------M/p1----S/f2

Rebased feature branch is then merged into Staging

----------------------M/p1----f2------S/f1

Master branch is fast-forward merged to stable position on Staging branch

----------------------p1------f2------M/S/f1

Cycle starts over with Master and Staging on same commit

--------------------------------------M/S
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment