Committing Code
This is a guide on how to commit code to the repository.
Prerequisites
- Have a GitHub account
- Have Git installed (see here for instructions on how to install Git)
- Have a local version of the development environment (see here for instructions on how to set it up)
Warning
Never commit directly to the main
or gh-pages
branches! This will cause the website to break.
Committing Code
- Make sure your changes are in a separate branch (not
main
)- If you have already made changes, don't worry. You can still commit them to a new branch.
- To make a new branch (and use it), type
git checkout -b <branch_name>
in the terminal. - To use an existing branch, type
git checkout <branch_name>
in the terminal.
- Add your changes to the staging area.
- To add all changes, type
git add .
in the terminal. - To add specific changes, type
git add <file_path>
in the terminal.
- To add all changes, type
- Commit your changes.
- To commit all changes, type
git commit -m "<commit_message>"
in the terminal. - To commit specific changes, type
git commit <file_path> -m "<commit_message>"
in the terminal.
- To commit all changes, type
- Push your changes to GitHub.
- To push all changes, type
git push
in the terminal. - To push specific changes, type
git push <file_path>
in the terminal.
- To push all changes, type
- Create a pull request on GitHub.
- To create a pull request, go to the repository on GitHub and click the
Compare & pull request
button. - Add a title and description for the pull request.
- Click the
Create pull request
button.
- To create a pull request, go to the repository on GitHub and click the
- Merging
- First, a test build is created to make sure the code compiles.
- Second, someone must approve the pull request (this can be done by anyone).
- Third, the pull request is merged to
main
. This will automatically deploy the changes to the website.