Last Updated: February 25, 2016
·
1.014K
· derhasi

Enforcing branch state on a staging repo

On our git based hosting, we reuse one site for staging and testing multiple of our feature/issue/integration branches. That site gets its code from a single branch (master), that will not change during the lifetime of the site. Therefore we have to push all changes in that single branch. That makes staying-in-sync-with-the-production site very hard (=impossible).

For solving that, I wrote a little bash script for simply pushing a "diff commit" to the staging repository. You can have a look at here: https://gist.github.com/derhasi/6615981

Usage

  1. Alter STAGING_REMOTE and STAGING_REMOTE_BRANCH to your needs
  2. execute bash staging.sh mybranchtopushtostaging