Skip to content
This repository was archived by the owner on Oct 27, 2022. It is now read-only.

Developer Bootstrap

Erich S. Huang edited this page Jun 3, 2015 · 1 revision

Git Development Workflow

Workflow

  1. Checkout the develop branch (git checkout develop)
  2. Pull down most current upstream changes (git pull upstream develop)
  3. Create a new feature branch (git checkout -b myNewFeatureBranch)
  4. Do your work and make commits
  5. Generally daily you'll want to push commits to origin (your GitHub fork) as offsite backup (git push origin myNewFeatureBranch)
  6. Once you finish your feature, pull in current state of upstream (git pull upstream develop)
  7. Resolve any merge conflicts
  8. Run full test suite locally, make sure it passes (nosetests -v)
  9. Push merged content (if any) to your fork (git push origin myNewFeatureBranch)
  10. Create a pull request on the GitHub UI to merge your myNewFeatureBranch into the stratus-medicine/Artemis-Services develop branch
  11. Code review changes with a colleague. In person or google hangout screen share works well.
  12. Have colleague merge the pull request

NOTE: Try to keep your code reviews small. You don't need to fully finish a feature to code review it in, especially if it is additive. Also commit often. Make sure that your code does not break the build before code reviewing it in. It is not the reviewer's job to catch this.

Warning: Always specify branch with push

You will save yourself heartache by parameterizing the branch on all of your git push commands. This is when you are sending commits to other repositories, meaning git push origin develop instead of just git push origin or git push. You should basically never type the unparameterized forced push: git push -f # don't!.

Common commands are:

# clone repository locally
git clone url-of-repository

# Create a new feature branch
git checkout develop
git checkout -b myNewFeatureBranch

# Commit changes
git commit -am'commit message'

# push your commits to your GitHub fork of the repo
git push origin myNewFeatureBranch

# merge in the upstream develop branch changes (other people's) into your current branch. this allows you to deal with all conflicts at once 
git pull upstream develop 

# (less common) alternatively, you can have the upstream changes applied to each of your commits individually. Usually just more effort than the above
git fetch upstream
git merge upstream develop

# delete local branch
git checkout develop
git branch -d myNewFeatureBranch

# delete feature branch from your github fork (you can also do this in the UI after merging the pull request) 
git push origin :myNewFeatureBranch

Clone this wiki locally