Skip to content

Instantly share code, notes, and snippets.

@adlenafane
Created July 24, 2017 13:36
Show Gist options
  • Save adlenafane/a383f6c3843efaa292c42579291ec924 to your computer and use it in GitHub Desktop.
Save adlenafane/a383f6c3843efaa292c42579291ec924 to your computer and use it in GitHub Desktop.

Inspired by this article

If working with a fork called upstream

  1. create your feature branch
# grab the latest from upstream/master
git pull --rebase upstream master
 
# create your feature branch
git checkout -b 123-wine-validations
  1. commit your changes
# stage and commit your changes to feature branch
git add -p
git commit -m "refs #123 - adding validations to wine model"
  1. deploy changes to dev for internal review
# rebase from upstream/master and resolve any conflicts
git pull --rebase upstream master
 
# switch to the dev branch
git checkout dev
 
# rebase from upstream/dev
# (which could contain merged branches from other team members)
git pull --rebase upstream dev
 
# merge your branch
git merge 123-wine-validations
 
# push changes to upstream/dev (which triggers a deploy)
git push upstream dev
  1. deploy changes to stage for test.v2 review
# checkout your feature branch and rebase from master
git checkout 123-wine-validations
git pull --rebase upstream master
 
# follow the previous step only using the test branch
git checkout test
git pull --rebase upstream test
git merge 123-wine-validations
git push upstream test
  1. deploy changes to production
# checkout your feature branch and rebase from master
git checkout 123-wine-validations
git pull --rebase upstream master
 
# push your branch to origin
git push origin 123-wine-validations
 
# open a Pull Request to merge feature branch into master

If working with no fork and a remote called origin

  1. create your feature branch
# grab the latest from origin/master
git pull --rebase origin master
 
# create your feature branch
git checkout -b 123-wine-validations
  1. commit your changes
# stage and commit your changes to feature branch
git add -A
git commit -m "refs #123 - adding validations to wine model"
  1. deploy changes to dev for internal review
# rebase from origin/master and resolve any conflicts
git pull --rebase origin master
 
# switch to the dev branch
git checkout dev
 
# rebase from origin/dev
# (which could contain merged branches from other team members)
git pull --rebase origin dev
 
# merge your branch
git merge 123-wine-validations
 
# push changes to origin/dev (which triggers a deploy)
git push origin dev
  1. deploy changes to stage for test.v2 review
# checkout your feature branch and rebase from master
git checkout 123-wine-validations
git pull --rebase origin master
 
# follow the previous step only using the test branch
git checkout test
git pull --rebase origin test
git merge 123-wine-validations
git push origin test
  1. deploy changes to production
# checkout your feature branch and rebase from master
git checkout 123-wine-validations
git pull --rebase origin master
 
# push your branch to origin
git push origin 123-wine-validations
 
# open a Pull Request to merge feature branch into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment