Home | History | Annotate | Download | only in platform
      1 # Contributing
      2 
      3 Want to contribute to Polymer? Great!
      4 
      5 We are more than happy to accept external contributions to the project in the form of [feedback](https://groups.google.com/forum/?fromgroups=#!forum/polymer-dev), [bug reports](../../issues), and pull requests.
      6 
      7 ## Contributor License Agreement
      8 
      9 Before we can accept patches, there's a quick web form you need to fill out.
     10 
     11 - If you're contributing as an individual (e.g. you own the intellectual property), fill out [this form](http://code.google.com/legal/individual-cla-v1.0.html).
     12 - If you're contributing under a company, fill out [this form](http://code.google.com/legal/corporate-cla-v1.0.html) instead.
     13 
     14 This CLA asserts that contributions are owned by you and that we can license all work under our [license](LICENSE).
     15 
     16 Other projects require a similar agreement: jQuery, Firefox, Apache, Node, and many more.
     17 
     18 [More about CLAs](https://www.google.com/search?q=Contributor%20License%20Agreement)
     19 
     20 ## Initial setup
     21 
     22 Here's an easy guide that should get you up and running:
     23 
     24 1. Setup Grunt: `sudo npm install -g grunt-cli`
     25 1. Fork the project on github and pull down your copy.
     26    > replace the {{ username }} with your username and {{ repository }} with the repository name
     27 
     28         git clone git (a] github.com:{{ username }}/{{ repository }}.git --recursive
     29 
     30     Note the `--recursive`. This is necessary for submodules to initialize properly. If you don't do a recursive clone, you'll have to init them manually:
     31 
     32         git submodule init
     33         git submodule update
     34 
     35     Download and run the `pull-all.sh` script to install the sibling dependencies.
     36 
     37         git clone git://github.com/Polymer/tools.git && tools/bin/pull-all.sh
     38 
     39 1. Test your change
     40    > in the repo you've made changes to, run the tests:
     41 
     42         cd $REPO
     43         npm install
     44         grunt test
     45 
     46 1. Commit your code and make a pull request.
     47 
     48 That's it for the one time setup. Now you're ready to make a change.
     49 
     50 ## Submitting a pull request
     51 
     52 We iterate fast! To avoid potential merge conflicts, it's a good idea to pull from the main project before making a change and submitting a pull request. The easiest way to do this is setup a remote called `upstream` and do a pull before working on a change:
     53 
     54     git remote add upstream git://github.com/Polymer/{{ repository }}.git
     55 
     56 Then before making a change, do a pull from the upstream `master` branch:
     57 
     58     git pull upstream master
     59 
     60 To make life easier, add a "pull upstream" alias in your `.gitconfig`:
     61 
     62     [alias]
     63       pu = !"git fetch origin -v; git fetch upstream -v; git merge upstream/master"
     64 
     65 That will pull in changes from your forked repo, the main (upstream) repo, and merge the two. Then it's just a matter of running `git pu` before a change and pushing to your repo:
     66 
     67     git checkout master
     68     git pu
     69     # make change
     70     git commit -a -m 'Awesome things.'
     71     git push
     72 
     73 Lastly, don't forget to submit the pull request.
     74