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.

git clone https://github.com/your_github_username_goes_here/rails.git
# Clones your fork of the repo into the current directory in terminal
$ /replace/with/path/to/your/rails/fork/railties/bin/rails new app_name_goes_here --dev
        
$ git commit -a -m "Describe your change in this message"
            # commit your changes. make sure to follow the guidance of a good commit message
       

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.

 $ git add remote git@github.com:rails/rails.git 
$ git checkout master
$ git pull --rebase upstream master
 $ git checkout my_branch
$ git rebase master
$ git rebase --continue
$ git push origin my_branch --force

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:

  1. switch to your feature branch
$ git checkout my_branch
  1. make changes & commit

  2. squash changes into one commit. rule is one feature == one commit

  3. 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!