Skip to content

Contributing Code to Formhub

Vernon Cole edited this page May 20, 2014 · 3 revisions

Contributing Code

Use Test Driven Development

  • any new code must have new tests for all new functionality
    • it is more efficient to use Test Driven Development
    • write tests before, or as, writing new functionality
    • info on TDD

Using git to create a new branch

  • get remote code from the server
    • clone the master branch for the latest stable version
    • if you have already cloned, pull the latest code
      • git pull origin master
      • pull from the master branch
  • create a new branch for your changes, we will call it 'new-version'
    • git checkout -b new-version
  • check if something on your computer does not match remote
    • git status
  • show changes to code
    • git diff
  • saving changed code as finished
    • git commit file.py -m "[message for file]"
  • putting changed code on the server
    • git push origin new-version

Using git to work on an existing branch

  • viewing local branches
    • git branch
  • viewing all branches
    • git branch -a
  • checking out another branch
    • git checkout -t new-version
  • get remote code for 'new-version'
    • git pull origin new-version

Running Tests

  • your branch must pass all tests before it will be merged
    • python manage.py test

Submit a pull request for your new branch