Skip to content

Code contribution guidelines

Tony edited this page Nov 23, 2020 · 2 revisions

Branches

Before working on a new issue, make sure to pull the latest changes from master using git pull and create a new branch following the syntax below. Once your pull request is merged, the branch can be deleted.

  • Branch names should follow this syntax <TYPE>/#-<ISSUE TITLE>:
  • <TYPE>: Type of issue you are working on (usually feature or bugfix)
  • #: The related issue number
  • <ISSUE TITLE>: Meaningful title for the issue, should be in snake_case

If I am assigned to issue #871/Add login form, I would name my branch like so: feature/871-login_form

Commits

Try to keep commits at a minimum to not overpopulate the history and also make it easier for reviewers to verify your code. Make sure to include meaningful messages in your commit messages. These practices make it easier for other developers to backtrack in the repository in case a bug infiltrates the master branch.

  • Commit messages should follow this syntax <TYPE>:<MESSAGE>:
  • <TYPE>: Type of issue you are working on (usually feature or fix)
  • MESSAGE: Meaningful message summarizing the code in the commit

If I fixed a bug involving registration confirmation email not being sent, my commit would be written like so: fix: fix issue preventing registration confirmation email to be sent

Pull requests

Once you've completed an issue on your branch, you should open a new pull request. A PR kind of puts your code into "standby" mode, where other developers can make suggestions on your code or approve it for merging. Here are the steps prior to merging a PR:

  1. Pull the latest changes from master. If needed, merge master into your branch and fix any conflicts
  2. Push your code into the GitHub server
  3. Find your branch in the list of branches of the repo, you should see a button "Compare & pull request"
  4. At least one person will need to approve your PR before merging it
  5. Squash and merge your branch, the "squashing" part ensures that the commit history is clean
  6. Delete your branch
  7. Close related issues
Clone this wiki locally