|
| 1 | +# CONTRIBUTING |
| 2 | + |
| 3 | +The MIT Linked Data group and the `ldnode` project welcomes new contributors. This document will guide you |
| 4 | +through the process. |
| 5 | + |
| 6 | +### Step 1: FORK |
| 7 | + |
| 8 | +Fork the project [on GitHub](https://github.com/linkeddata/ldnode) and check out |
| 9 | +your copy. |
| 10 | + |
| 11 | +```sh |
| 12 | +$ git clone git@github.com:your_username/ldnode.git |
| 13 | +$ cd ldnode |
| 14 | +$ git remote add upstream git://github.com/linkeddata/ldnode.git |
| 15 | +``` |
| 16 | + |
| 17 | + |
| 18 | +### Step 2: BRANCH |
| 19 | + |
| 20 | +Create a feature branch and start hacking: |
| 21 | + |
| 22 | +```sh |
| 23 | +$ git checkout -b my-feature-branch -t origin/master |
| 24 | +``` |
| 25 | + |
| 26 | + |
| 27 | +### Step 3: COMMIT |
| 28 | + |
| 29 | +Make sure git knows your name and email address: |
| 30 | + |
| 31 | +```sh |
| 32 | +$ git config --global user.name "J. Random User" |
| 33 | +$ git config --global user.email "j.random.user@example.com" |
| 34 | +``` |
| 35 | + |
| 36 | +Writing good commit logs is important. A commit log should describe what |
| 37 | +changed and why. Follow these guidelines when writing one: |
| 38 | + |
| 39 | +1. The first line should be 50 characters or less and contain a short |
| 40 | + description of the change prefixed with the name of the changed |
| 41 | + subsystem (e.g. "net: add localAddress and localPort to Socket"). |
| 42 | +2. Keep the second line blank. |
| 43 | +3. Wrap all other lines at 72 columns. |
| 44 | + |
| 45 | +A good commit log looks like this: |
| 46 | + |
| 47 | +``` |
| 48 | +subsystem: explaining the commit in one line |
| 49 | +
|
| 50 | +Body of commit message is a few lines of text, explaining things |
| 51 | +in more detail, possibly giving some background about the issue |
| 52 | +being fixed, etc etc. |
| 53 | +
|
| 54 | +The body of the commit message can be several paragraphs, and |
| 55 | +please do proper word-wrap and keep columns shorter than about |
| 56 | +72 characters or so. That way `git log` will show things |
| 57 | +nicely even when it is indented. |
| 58 | +``` |
| 59 | + |
| 60 | +The header line should be meaningful; it is what other people see when they |
| 61 | +run `git shortlog` or `git log --oneline`. |
| 62 | + |
| 63 | +Check the output of `git log --oneline files_that_you_changed` to find out |
| 64 | +what subsystem (or subsystems) your changes touch. |
| 65 | + |
| 66 | + |
| 67 | +### Step 4: REBASE |
| 68 | + |
| 69 | +Use `git rebase` (not `git merge`) to sync your work from time to time. |
| 70 | + |
| 71 | +```sh |
| 72 | +$ git fetch upstream |
| 73 | +$ git rebase upstream/master |
| 74 | +``` |
| 75 | + |
| 76 | + |
| 77 | +### Step 5: TEST |
| 78 | + |
| 79 | +Bug fixes and features should come with tests. Add your tests in the |
| 80 | +`test/` directory. Look at other tests to see how they should be |
| 81 | +structured (license boilerplate, common includes, etc.). |
| 82 | + |
| 83 | +```sh |
| 84 | +$ npm test |
| 85 | +``` |
| 86 | + |
| 87 | +Makeall tests pass. Please, do not submit patches that fail either check. |
| 88 | + |
| 89 | + |
| 90 | +### Step 6: PUSH |
| 91 | + |
| 92 | +```sh |
| 93 | +$ git push origin my-feature-branch |
| 94 | +``` |
| 95 | + |
| 96 | +Go to https://github.com/username/ldnode and select your feature branch. Click |
| 97 | +the 'Pull Request' button and fill out the form. |
| 98 | + |
| 99 | +Pull requests are usually reviewed within a few days. If there are comments |
| 100 | +to address, apply your changes in a separate commit and push that to your |
| 101 | +feature branch. Post a comment in the pull request afterwards; GitHub does |
| 102 | +not send out notifications when you add commits. |
| 103 | + |
| 104 | +## Using HUB |
| 105 | + |
| 106 | +[hub](https://hub.github.com/) is a tool released by Github to help developers to use their website from command line. |
| 107 | + |
| 108 | +The described guidelines can be resumed as following: |
| 109 | + |
| 110 | +```bash |
| 111 | +$ git clone https://github.com/linkeddata/ldnode |
| 112 | +$ cd ldnode |
| 113 | + |
| 114 | +# to fork the repository |
| 115 | +$ hub fork |
| 116 | + |
| 117 | +# to fork the repository |
| 118 | +$ git checkout -b feature-branch |
| 119 | + |
| 120 | +# after committing your changes, push to your repo |
| 121 | +$ git push your_username feature-branch |
| 122 | + |
| 123 | +# start a PR |
| 124 | +$ hub pull-request |
| 125 | +``` |
| 126 | + |
| 127 | +This document is forked from [joyent/node](https://github.com/joyent/node/blob/master/CONTRIBUTING.md) |
| 128 | + |
| 129 | + |
| 130 | +[issue tracker]: https://github.com/linkeddata/ldnode/issues |
0 commit comments