How do I use git flow with a staging environment?

Eric picture Eric · Apr 15, 2013 · Viewed 8.4k times · Source

We are using git-flow to handle hotfixes & features, with a develop branch & the master branch (for production).

What is the easiest way to add a staging branch to the mix so that we can validate work that is on its way to production from develop while still keeping the helpfulness of git-flow?

Answer

Klas Mellbourn picture Klas Mellbourn · Apr 15, 2013

I would say that staging should be based on a git flow release branch. After a git flow release start and git flow release publish you can start QA work on that branch, including deploying it to a staging area. When the QA work in the staging area has proven the code ready for production deploy in production and do git flow release finish.

If you are using TeamCity, you can easily set up the server to detect new remote release branches and automatically set up builds for them, see here.