Contributing to Ruby on Rails - A Guide
Recently, I have started contributing to Ruby on Rails – the popular web framework for quickly building web applications. I have just started but couple of my commits have been merged into rails core & have a pretty good idea on contributing to rails. this guide details how you can start contributing to rails.
Step 0 - Decide what to contribute
It could be a bug or feature that you want aka starch your itch. It could a bug fix in which cause check github issue tracker for existing issues & see if you can fix anyone of them and send a Pull Request. It could be removing a warning from test. Or it would contributing documentation.
Step 1 - Fork & Change
This is rather simple but you must know how to use git - the popular distributed version control system. If you don’t then please following this guide closely & read multiple times until you understand.
-
Goto rails page on github & click the “Fork” button on the top. requires github account. so register if not already done. Its free!
-
You’ve successfully forked rails, but so far it only exists on GitHub. To be able to work on the project, you will need to clone it to your local machine.
- Create a new branch
- Create new rails app based on your fork
- Do your changes. Now whatever changes you do, would instantly get reflected into your rails app. Once you are okay with said changed, commit them
Step 2 - Create a Pull Request
so you have made your change, tested it.Sweet! Now, its time to send your awesome changes to rails core team for review.
- Add Upstream:
- switch back to master, pull latest changes
- Switch back your branch & Reapply your changes ontop of latest changes of the rails’ upstream master
- In the process of the rebase, it may discover conflicts. In that case it will stop and allow you to fix the conflicts. After fixing conflicts, use git add . to update the index with those contents, and then just run:
- Push branch to GitHub
- Open Pull request using github’s web-interface.
Congratulation on your contribution! Now, wait for comments on the Pull request.
Step - 3
Once your Pull request is opened, most probably someone will suggest 1 or 2 changes. hers is how to do them:
- switch to your feature branch
-
make changes & commit
-
squash changes into one commit. rule is one feature == one commit
-
force push
To close, let me welcome you the world of open source. where code you write gets used by thousands of developers & affects lives of millions of people around the world. Its pretty amazing!