- we use a lot of open source software in our daily work, developers’ lives would be much harder without open source
- It is fun to contribute, and give back to the community
- You can build your own reputation as a developer, and your company’s reputation as well
- Last but not least, you can earn a hacktoberfest T-shirt 🙂
Find a project
Fork the project
You shouldn’t clone the original repository, but create a fork from the project. It is easy to do on GitHub, just click on the Fork button after opening the repository:
When the fork has been created, you can clone your own fork:
Depending on the project you might need to do some set up and initialization, for example:
- composer install
- npm install
- npm run dev
Usually open-source project already have test framework installed, and already have tests. Depending on the project it might be phpunit, codecept, jasmine, jest, junit or any other. As a first step create a failing test, which reproduces the issue you want to fix. It is a important step, so the maintainer of the project can reproduce the issue, and see if your fix is appropriate, and last but not least the test ensures that the changes made later would not break your fix.
Fix the issue, make your test pass, but run all the tests before creating the pull request and make sure they all pass.
Create a pull request
When the changes are done, the tests pass, commit and push your changes to your fork. Create a pull request to the original repository, to let the maintainer know, you fixed the issue and want to contribute.
If everything went well and your changes can be merged to the original repository without any conflicts, you can create the pull request:
Reference the issue
On GitHub you can reference the issue by using the following keywords in your commit or pull request messages:
Using one of these keywords the issue will be closed automatically when the pull request is approved.
For example: This PR fixes #12.
You can find more info on this topic on GitHub’s help page here.
When should we do it? The general answer is always :-), but especially NOW, the Hacktoberfest is already started and it lasts in whole October. You need to create 4 pull requests to open source repositories and if the maintainer doesn’t mark it as spam, you will be eligible to participate. The first 50.000 participants will earn a T-shirt.
Let’s go hacking!