diff --git a/content/essential-knowledge/how-to-contribute-code.md b/content/essential-knowledge/how-to-contribute-code.md new file mode 100644 index 0000000..c373de7 --- /dev/null +++ b/content/essential-knowledge/how-to-contribute-code.md @@ -0,0 +1,65 @@ +# A guide on how to contribute code + +Welcome! If you're new to GitHub and open source, it can seem quite difficult to get started. +Here is a step-by-step guide on how to contribute code to the SourceBots project! + +## How to set up GitHub +[Create a GitHub account](https://github.com/join), or log in if you already have an account. + +It's useful to stay logged in, so it's as easy as possible to keep up to date and make contributions. + +## How to choose something to work on +Have a look at [TODO: find page] + +## Encouragement to make small changes +We encourage you to make any changes, however small. e.g. if you spot a spelling error somewhere, why not fix it and make a pull request? This is a good way to familiarise yourself with the process, and is a good stepping stone towards larger contributions. + +## How to make a small change (e.g. to website / docs) using GitHub online editor: + +Suppose you have a file you'd like to change. Then, + +TODO: *all* the steps. Make a commit to a new branch, submit a PR. In detail, for people who have never used git. + +* becoming a member of SourceBots organisation +* setting up a new branch on the SourceBots repo (not creating a fork) +- or, depending on our contribution system, creating a fork. +* making an edit (with the pencil icon) -> set up a new branch, if you haven't already. +Naming the branch. +You can't push to master. +This might create a fork automatically for you if you're not a member of the [SourceBots organisation](https://github.com/sourcebots). +* committing the changes (with meaningful commit message + description) +* adding more changes to your branch (flat structure: don't create a sub-branch (terminology?) and do a PR from sub-branch -> your new branch?) +* creating a pull request (TODO: when?) +* waiting for someone to review your code (and/or asking for feedback, perhaps on the slack) +* committing more changes, completing the review process + +TODO: put these TODOs in more appropriate places other than in the document itself? + +TODO: link to a good guide (with more detail) about this. But it's good to have our own version for making minimal commits and PRs for *our* specific workflow. It's also a useful way for people like myself to learn by writing. + +TODO: include *tip* boxes? For tangential but useful information/explanation about the general principles behind e.g. commits, forks, branches, and more complete guides/exceptions about when to do different things. (Or, in another style? By an example of a project with good documentation) + +## How to set up git on your local machine +To make more advanced changes, it may be necessary to install and set up git on your local machine. +To install git, see https://git-scm.com/book/en/v2/Getting-Started-Installing-Git. + +TODO: + +* adding ssh keys, where relevant +* adding GitHub auth tokens, where relevant +* ? does the GitHub desktop app, or GitKraken, or other IDEs guide you through this process well? Subsections maybe + +## Using git by CLI / GitHub desktop app (e.g. adding some code) +TODO: + +* setting up a new branch on the SourceBots repo (not creating a fork) +* how to make a commit +* how to push to a branch + + +## Conventions for PRs, commits, comments + +More advanced: + +* Code review (?) +* Setting up dev environment