## Doing a staging cut This involves taking what is in mainline(master) and moving it to staging. ``` git checkout staging git pull origin staging git checkout master git pull origin master git merge staging git checkout staging git reset --hard master git push origin staging --force ``` ### Fixing bugs in staging You will create a branch off of staging and work on it. Then merge it into staging and master. ``` git checkout staging git pull origin staging git checkout -b my_staging_bug_fix_branch staging ``` Do your commits now. When you are done: ``` git checkout staging git pull origin staging git checkout my_staging_bug_fix_branch git rebase staging git checkout staging git merge --no-ff my_staging_bug_fix_branch git push origin staging ``` If the push goes through, update master as follows: ``` git checkout master git pull origin master git merge staging git push origin master ``` ## Doing a production cut This involves taking what is in staging and moving it to production. We also tag what was in production, before updating it. The reason we do the tagging now, is because the production branch has had a chance to bake for a while and is relatively stable. ``` git checkout production git pull origin production git tag -a release-2016-02-15 git push --tags git checkout staging git pull origin staging git merge production git push origin staging git checkout master git pull origin master git merge staging git push origin master git checkout production git reset --hard staging git push origin production --force ``` ### Fixing production bugs You will create a branch off of production and work on it. And this time, when you are done fixing the bug you will merge it back production, staging and master. ``` git checkout production git pull origin production git checkout -b my_production_bug_fix_branch production ``` Do your commits now. When you are done: ``` git checkout production git pull origin production git checkout my_production_bug_fix_branch git rebase production git checkout production git merge --no-ff my_production_bug_fix_branch git push origin production ``` If the push goes through, update staging and master as follows: ``` git checkout staging git pull origin staging git merge production git push origin staging git checkout master git pull origin master git merge production git push origin master ```