Understanding the GitHub Flow provides a good conceptual overview of how typical collaboration and development takes place. The Forking Workflow explains the mechanics of how contributions are made.
Pull requests --- patches, improvements, new features --- are a fantastic help.
Please ask first before embarking on any significant pull request. You can comment on the relevant issue, post in the chat room, or open a new issue to start or join a discussion. It is also a good idea to discuss your solution/changes/approach before starting any implementation.
Pull requests should remain focused in scope and avoid containing unrelated commits. They should also adhere to the code style guidelines used throughout the project.
IMPORTANT: By contributing your code, you agree to license your contribution under the terms of the project's license.
Adhering to the following process is the best way to get your work included in the project:
-
Set up your development environment, if not set up already.
-
Sync your local
master
branch with the upstream repository and then update your fork on GitHub:git checkout master git pull upstream master git push origin master
-
Create a new topic branch (off the main project development branch) to contain your feature, change, or fix:
git checkout -b <topic-branch-name>
-
Stage your changes before committing. Type the following for every individual added/modified/deleted file (instead of staging all changes in one go, to ensure you do not accidentally add any sensitive or unnecessary files):
git add path/to/modified_file
-
Commit your changes in logical chunks. Please adhere to the Git commit message guidelines. Running the following will also run the Git hooks installed during setup:
git commit
-
Locally merge (or rebase) the upstream development branch into your topic branch (if merge conflicts arise then please fix them):
git pull [--rebase] upstream master
-
Push your topic branch up to your fork:
git push origin <topic-branch-name>
-
We use Travis CI for continuous integration. Every time a pull request is opened or updated with more commits, a build is triggered. It is a good idea to test your code locally before opening a pull request, so as to avoid failed builds and needing to revise the pull request. Use the following command to run the tests exactly as they are run by Travis CI:
./scripts/ci
-
Create a pull request for merging into the upstream
master
branch. You're all set! Now wait for someone to review your code and merge your changes.
Thank you and congratulations! After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
-
Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
git push origin --delete <topic-branch-name>
-
Check out the
master
branch:git checkout master
-
Delete the local branch:
git branch -D <topic-branch-name>
-
Update your local
master
branch with the latest upstream version:git pull upstream master
-
Update your fork on GitHub:
git push origin master
-
Avoid pushing changes to the
master
branch of your fork. Changes should be in their own branch, which should then be merged intoupstream/master
through a pull request. Your fork'smaster
branch should always be in sync withupstream/master
. If you open a pull request with changes made directly on yourmaster
branch, and your pull request happens to get rejected, your fork'smaster
branch will remain ahead ofupstream/master
, which is a messy situation to fix. Therefore, always make changes in a new branch. -
You can skip a Travis CI build if a build is unnecessary for a particular commit.
-
If your pull request contains a fix for a bug or implements a new feature, you can have the corresponding issue closed automatically when the pull request is merged.
-
Whenever you change branches or
pull
from another branch, untracked and auto-genrated files may get out of sync, which might lead to errors. For example, it is a good idea to runnpm install
for projects which use npm after changing branches or pulling from another branch. It is sometimes necessary to remove thenode_modules
directory before runningnpm install
to ensure you have the latest dependencies.