Skip to content

Contributing to Backbone

jashkenas edited this page Jan 30, 2012 · 7 revisions

Using GitHub to report issues

To file a bug report, please visit the GitHub issues page. It's great if you can attach code (test cases and fixes for bugs, and test cases and a proposed implementation for features), but reproducible bug reports are also welcome.

Cloning master and running the test suite

To get started contributing to Backbone, first clone the repository and make sure you can run the test suite. If you're not familiar with Git, visit the Git homepage to download Git for your platform.

First, clone the repository:

$ git clone git://github.com/documentcloud/backbone.git
$ cd backbone

Next, open test/test.html to run the QUnit test suite. If you see all the tests passing, you're ready to contribute!

Contributing to the Backbone documentation

Perhaps the easiest way to get started with contributing is through the docs. If you find typos, bugs, or omissions in the docs, please submit a pull request to fix. The Backbone documentation is maintained in the GitHub repository, alongside the code. Documentation is in index.html in the root, and the docs/ directory.

Contributing to the Backbone code

This contribution process is based on the Ruby on Rails contribution guide. In general, include tests with new features or bugfixes, work in a feature branch until you're ready to submit or discuss your code, then fork the repository, push to your fork, and issue a pull request.

Note: When submitting a pull request for code, please don't add documentation, rebuild the annotated source code, or rebuild the minified production file -- all of those tasks are done when cutting a new release.

Let's say I'm going to submit a patch to add fictitious SprocketWidget support:

$ git checkout -b sprocket-widget
$ vim test/
  # (...add tests...)
$ vim backbone.js
  # (...add support...)
$ open test/test.html
  # (...make sure tests run...)
$ git commit -m "Add SprocketWidget support"

Then, fork the Backbone repository, and push your branch to your fork:

$ git remote add <your user name> [email protected]:<your user name>/backbone.git
$ git push <your user name> sprocket-widget

Finally, issue a pull request from inside the GitHub interface, and your contribution is ready for consideration, discussion, and (hopefully) merging in!