Skip to content

Instantly share code, notes, and snippets.

@santosh79
Created February 16, 2016 04:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santosh79/fcd7a8b9e7eee545d4b3 to your computer and use it in GitHub Desktop.
Save santosh79/fcd7a8b9e7eee545d4b3 to your computer and use it in GitHub Desktop.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment