|
| 1 | +# How to contribute |
| 2 | +Thank you for considering to contribute to this repository! This file will walk you through all the steps to ensure both |
| 3 | +you and I have a good time submitting and reviewing your contribution. First off, some basic rules and reading material: |
| 4 | + |
| 5 | +- Submit your work in a new branch and make the PR to the master branch. |
| 6 | +- [Write a short & descriptive commit message](http://chris.beams.io/posts/git-commit/). |
| 7 | +- Rebase before committing the final change. |
| 8 | +- Stick to [PSR-2](http://www.php-fig.org/psr/psr-2/). |
| 9 | +- Add tests if necessary and ensure all the tests are green on the final commit. |
| 10 | +- Make sure the CI tools used by the repository are all in order. If one fails, you should make it pass. |
| 11 | + |
| 12 | +## Contributing |
| 13 | +Here are the steps to follow to contribute to this repository: |
| 14 | + |
| 15 | +- [Fork this repository on GitHub](#fork-this-repository). |
| 16 | +- [Clone your fork to your local machine](#clone-your-fork). |
| 17 | +- [Create a feature branch](#create-a-branch). |
| 18 | +- [Add an 'upstream' remote](#add-a-remote). |
| 19 | +- [Regularly pull & rebase from the upstream remote](#pull-and-rebase). |
| 20 | +- [Work on feature branch](#working-on-branch). |
| 21 | +- [Submit a pull request to the master branch](#submitting-pull-request). |
| 22 | + |
| 23 | +### Fork this repository |
| 24 | +Fork the repository right here on GitHub. To learn more about forking a repository, visit |
| 25 | +[GitHub's help article](https://help.github.com/articles/fork-a-repo/). |
| 26 | + |
| 27 | +### Clone your fork |
| 28 | +Clone your repository on your local machine to start work on your pull request. |
| 29 | + |
| 30 | +```bash |
| 31 | +$ git clone [email protected]: <USERNAME >/ <REPOSITORY >.git |
| 32 | +# Or if you prefer HTTPS: |
| 33 | +$ git clone https://github.com/<USERNAME>/<REPOSITORY>.git |
| 34 | + |
| 35 | +$ cd <REPOSITORY> |
| 36 | +``` |
| 37 | + |
| 38 | +### Create a branch |
| 39 | +Make your own feature branch in order not to clutter up master. |
| 40 | + |
| 41 | +```bash |
| 42 | +# Think of a good name for your branch: |
| 43 | +# fix/typo-in-readme |
| 44 | +# feature/some-feature |
| 45 | +# bug/some-bug-you-are-fixing |
| 46 | +$ git checkout -b <BRANCH_NAME> |
| 47 | +``` |
| 48 | + |
| 49 | +### Add a remote |
| 50 | +Add an 'upstream' remote to pull from and to stay up to date with the work being done in there. |
| 51 | + |
| 52 | +```bash |
| 53 | +# List all current remotes |
| 54 | +$ git remote -v |
| 55 | +origin [email protected]/ <USERNAME >/ <REPOSITORY >.git (fetch) |
| 56 | +origin [email protected]/ <USERNAME >/ <REPOSITORY >.git (push) |
| 57 | + |
| 58 | +# Add a new remote called 'upstream' |
| 59 | +$ git remote add upstream [email protected]:san-kumar/ <REPOSITORY >.git |
| 60 | +# Or if you prefer HTTPS: |
| 61 | +$ git remote add upstream https://github.com/san-kumar/<REPOSITORY>.git |
| 62 | + |
| 63 | +# The new remote should now be in the list |
| 64 | +$ git remote -v |
| 65 | +origin [email protected]/ <USERNAME >/ <REPOSITORY >.git (fetch) |
| 66 | +origin [email protected]/ <USERNAME >/ <REPOSITORY >.git (push) |
| 67 | +upstream [email protected]/san-kumar/ <REPOSITORY >.git (fetch) |
| 68 | +upstream [email protected]/san-kumar/ <REPOSITORY >.git (push) |
| 69 | +``` |
| 70 | + |
| 71 | +### Pull and rebase |
| 72 | +Pull from upstream to stay up to date with what others might be doing in this repository. Any merge conflicts that arise |
| 73 | +are your responsibility to resolve. |
| 74 | + |
| 75 | +```bash |
| 76 | +$ git pull --rebase upstream master |
| 77 | +``` |
| 78 | + |
| 79 | +### Working on branch |
| 80 | +Do your magic and make your fix. I can't help you with this :wink:. Once you're happy with the result and all tests pass, |
| 81 | +go ahead and push to your feature branch. |
| 82 | + |
| 83 | +```bash |
| 84 | +$ git push origin <BRANCH_NAME> |
| 85 | +``` |
| 86 | + |
| 87 | +### Submitting pull request |
| 88 | +Now, let's head back over to this repository on GitHub and submit the pull request! |
0 commit comments