This document contains general guidelines for contributing to this project:
- Prerequisites
- Getting the Project Source
- Get the App Running
- Pivotal Tracker Workflow
- Git Workflow
- Questions or Problems?
Please note that this project is released with a contributor code of conduct. By contributing to this project you are also agreeing to abide by its terms.
Make sure your development environment is properly setup by following the development environment setup guide.
It is recommended to setup ssh. Please add a new SSH key to your GitHub account.
$ cd ~
$ mkdir -p workspace && cd workspace
$ git clone [email protected]:CodeForSocialGood/calltocode.org
$ cd calltocode.org/
- Learn about forking here.
- Fork the main calltocode.org repository.
- Clone your fork of the repository and define an upstream remote pointing back to the main calltocode.org repository that you forked in the first place:
$ cd ~
$ mkdir -p workspace && cd workspace
$ git clone [email protected]:<github username>/calltocode.org
$ cd calltocode.org/
$ git remote add upstream https://github.com/CodeForSocialGood/calltocode.org
$ yarn
Use this local build for development:
$ yarn db start
$ yarn start
Note: ports 3000, 27017, and 28017 will need to be available on your machine to run the app. If you run into a problem here, checkout our database troubleshooting.
$ yarn test
We use Pivotal Tracker to track our user stories.
- Each story has a story type, story id and story name which will be used in your git workflow
- There are three different story types: feature, bug, and chore
- The story id looks like
#153540677
- The story name looks like
Encrypt password
Stories in the backlog that say Start
are available for starting. They are prioritized top-down, but can really be done in any order.
Start
when you start working. This prevents having two people start separate work on the story.Finish
when you submit the PR for your work on Github.Deliver
when the PR gets approved and merged into master.Accept
when the changes are verified in the test environment.Reject
when the changes aren't verified in test environment.
Start
when you start working. This prevents having two people start separate work on the story.Finish
when you submit the PR and it is approved and merged into master.
If you're working through a fork: see our detailed contributing guidelines which outlines our git workflow (and has screenshots), focused on contributing through a fork.
If you have a branch on the main repository's upstream:
$ git checkout master
$ git pull -r
If you have your own fork and want to update your master:
$ git checkout master
$ git pull -r upstream master
$ git push origin master
When you start new work, always create a new branch off of the master branch, using the corresponding pivotal tracker story type and story id:
$ git checkout master
$ git checkout -b <story type>/<story id>
Jump back to the Pivotal Tracker Workflow section for more information about story type and story id.
Always pair when you start a new branch:
# If you are working solo
$ git solo <initials>
# If you are pairing with someone
$ git duet <initials-1> <initials-2>
For more details, go to developer environment setup.
Reference the pivotal tracker story id for the story you are working on:
$ git commit
# Below, the commit message is between the ---'s
---
chore: add something
[<story id>]
---
Jump back to the Pivotal Tracker Workflow section for more information about story id.
Once you are finished with the story, run the tests to make sure your changes are linted and haven't broken any tests:
$ yarn test
Then, push your branch to the repository before creating a pull request:
$ git push --set-upstream origin <branch-name>
You can now create a pull request using the Github web interface. Please format the PR as follows:
- Pull Request Title:
<story type>/<story id> - <story name>
<story type>
is required and one of the following:- Feature - a feature story
- Fix - a bug story
- Chore - a chore story
<story id>
is required:- For example:
#153540677
- For example:
<story name>
is required:- For example:
Encrypt password
- For example:
- Full Example:
Feature/#153540677 - Encrypt password
- Pull Request Body: no requirements
Once you have submitted your pull request (PR), it needs to be approved and updated with the master
branch's latest changes with all conflicts resolved before it can be merged. See the section below on how to deal with this.
Jump back to the Pivotal Tracker Workflow section for more information about story type, story id and story name.
If you need to resolve conflicts with master or update your branch with the latest changes from master after you've already pushed changes and possibly after you've submitted a pull request, it is best to do the following:
$ git checkout master
$ git pull -r
$ git checkout <your branch>
$ git rebase master
# Repeat this step until there are no more conflicts
$ git status
# Follow instructions printed by git, then
$ git rebase --continue
$ git push -f
This is a good practice because it will rebase your branch's changes on top of the latest changes on the master
branch, avoiding any ugly/noisy merge commits on your branch.
In some cases you can update your branch using the "Update branch" button inside of your open pull request. This is available when there are no (complex) conflicts between your branch and master, and will always create an "ugly" merge commit on your branch. In our case, this doesn't really matter because we squash the commits in our PRs into one commit when we merge into master, but the above workflow is necessary when conflicts are too complex to be resolved through the browser.
If you're stuck on something, don't be afraid to ask around in Slack! You can also check out our list of Common Problems to see if your issue is addressed there.