So you've found a bug you want to fix, or a feature you want to implement, thanks! If you follow this guide it will make it much easier for the community to review your changes, and the core team to get them included in the next release. If you need an introduction to git, check out the tutorial and every day git in 20 commands or so
Making Your Changes
The first thing you need to do is obtain a clone of the rails repository
$ git clone git://github.com/rails/rails.git
$ cd rails
Then you need to create your new branch:
$ git checkout -b make_rails_scale
Switched to a new branch "make_rails_scale"
Now you're ready to get hacking. Be sure to include tests which demonstrate the bug you're fixing, and fully exercise any new features you're adding. You should also take care to make sure the documentation is updated if you're changing the API.
Preparing your changes for submission.
Now that you've made your changes it's time to get them into a patch. We need to update rails and fix any conflicts we had.
$ git checkout master
Switched to branch "master"
$ git pull
...
$ git checkout make_rails_scale
Switched to branch "make_rails_scale"
$ git rebase master
Once you've fixed any conflicts, you're ready to create a patch:
$ git format-patch master --stdout > your-patch-file.diff
Now you can attach that patch file to a lighthouse ticket and add the 'patch' tag. Once you have a patch and a lighthouse ticket you need to find some people to give you feedback. You can either email the core list or ask in #rails-contrib on irc.freenode.net
Reviewing Changes
To apply someone's changes you need to first create a branch:
$ git checkout -b koz_made_rails_scale
Then you can apply their patch
$ git am < their-patch-file.diff
Once you have a working copy, you should take note of the following kinds of things:
- Are you happy with the tests, can you follow what they're testing, is there anything missing
- Does the documentation still seem right to you
- Do you like the implementation, can you think of a nicer or faster way to implement a part of their change
Once you're happy it's a good change, comment on the lighthouse ticket indicating your approval. Your comment should indicate that you like the change and what you like about it. Something like:
+1. I like the way you've restructured that code in generate_finder_sql, much nicer. The tests look good too.
If your comment simply says +1, then odds are other reviewers aren't going to take it too seriously. Show that you took the time to review the patch. Once three people have approved it, add the verified tag. This will bring it to the attention of a committer who'll then review the changes looking for the same kinds of things.
Congratulations and Thank You!
Once your changes have been applied, you've officially become part of the large community of independent contributors working to improve ruby on rails.
Important Notes
- Rails core team prefers that you create a github fork only for large changesets which are likely to involve a lot of code reviews/changes back and forth, or if 2 or more people are working on the same feature/bug. Docrails and Rack on Rails are good examples of cases where forks are preferable over git formatted patches. But of course, like all the rules, exceptions can be made for cases that demands for it.
Source available from github
The Git repository resides at http://github.com/rails
Check out the current development trunk (Edge Rails) with:
git clone git://github.com/rails/rails.git
The latest development for the 1.2.x and 2.0.x releases are on the 1-2-stable and 2-0-stable branches.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post the code sample that causes the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
Security vulnerabilities should be reported via an email to security@rubyonrails.org, do not use trac for reporting security vulnerabilities. All content in trac is publicly available as soon as it is posted.
Then don't get your hopes up. Unless you have a "Code Red, Mission Critical, The World is Coming to an End" kinda bug, you're creating this ticket in the hope that others with the same problem will be able to collaborate with you on solving it. Do not expect that the ticket automatically will see any activity or that others will jump to fix it. Creating a ticket like this is mostly to help yourself start on the path of fixing the problem and for others to sign on to with a "I'm having this problem too".
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
