Skip to content

How to Contribute

Wenbo Tao edited this page Oct 19, 2020 · 5 revisions

Adding pre-commit hooks

Before implementing any changes, you need to add pre-commit hooks we provide to check code styles. Under the git root directory, run ln -s -f $PATH_TO_KYRIX/docker-scripts/pre-commit $PATH_TO_KYRIX/.git/hooks/pre-commit. PATH_TO_KYRIX is the absolute path to your Kyrix root directory. Note that you need to have npm and java installed.

After this, an automated script will check the code styles of your changes every time you make a commit.

Implementing a Change

  1. Make sure you're on the master branch. git branch -l If not, switch to the master branch. git checkout master
  2. Pull the latest updates from master git pull origin master
  3. Create a new branch named after the feature that you're implementing git checkout -b "my_new_feature"
  4. Push the branch to origin, setting up tracking git push -u origin my_new_feature
  5. Implement your changes, making sure to regularly commit with good commit messages and push your changes with git push origin my_new_feature

Merging a Change

  1. After pushing, check the main github page of the project and there should be an option to create a pull request from your recently pushed branch.

  2. Make the pull request and give a brief description. If the pull request addresses an open issue (say, issue 4), add the text closes #4 to the body of the request, so that merging the pull request will also close the issue.

  3. Let others review and approve the pull request. This may require you to make new commits to the branch, which can be added to the pull request with git push origin my_new_feature. Eventually, the reviewer approves the changes (commenting on the pull request).

  4. If your branch is clear to merge, there should be a big green button on the bottom of the page that lets you merge. You might have some merge conflicts, however, in which case the merge button will be red. To resolve this, get the latest changes on master (git merge master), then run git status to see which files have conflicts.

  5. Now, squash your changes into a single commit to keep the log clean. To do this, go to your PR page, push the big green button saying "Squash and merge". We do not allow other types of merge.

  6. Push the "delete this branch" button to remove your remote feature branch. Your local repo doesn't know that the remote branch has been deleted, so clean up state with:

     git checkout master
     git branch -D my_new_feature
    
  7. All done!

Testing with Docker

We recommend using docker for consistent dev environments. Every time you make a change (to compiler, back-end or front-end), you can run docker-compose build to send your changes into the containers.