|
| 1 | +# Contributing to ercp_basic_example |
| 2 | + |
| 3 | +ercp_basic_example is written in [Rust](https://www.rust-lang.org/). |
| 4 | + |
| 5 | +For branching management, this project uses |
| 6 | +[git-flow](https://github.com/petervanderdoes/gitflow-avh). The `main` branch is |
| 7 | +reserved for releases: the development process occurs on `develop` and feature |
| 8 | +branches. **Please never commit to master.** |
| 9 | + |
| 10 | +## Setup |
| 11 | + |
| 12 | +### Local repository |
| 13 | + |
| 14 | +1. Fork the repository |
| 15 | + |
| 16 | +2. Clone your fork to a local repository: |
| 17 | + |
| 18 | + $ git clone https://github.com/you/ercp_basic_example.git |
| 19 | + $ cd ercp_basic_example |
| 20 | + |
| 21 | +3. Add the main repository as a remote: |
| 22 | + |
| 23 | + $ git remote add upstream https://github.com/ercp/ercp_basic_example.git |
| 24 | + |
| 25 | +4. Checkout to `develop`: |
| 26 | + |
| 27 | + $ git checkout develop |
| 28 | + |
| 29 | +### Building the project |
| 30 | + |
| 31 | +1. Build the project: |
| 32 | + |
| 33 | + $ cd ercp_basic_example |
| 34 | + $ cargo build |
| 35 | + |
| 36 | +2. Run the tests: |
| 37 | + |
| 38 | + $ cargo test |
| 39 | + |
| 40 | +All the tests should pass. |
| 41 | + |
| 42 | +## Workflow |
| 43 | + |
| 44 | +To make a change, please use this workflow: |
| 45 | + |
| 46 | +1. Checkout to `develop` and apply the last upstream changes (use rebase, not |
| 47 | + merge!): |
| 48 | + |
| 49 | + $ git checkout develop |
| 50 | + $ git fetch --all --prune |
| 51 | + $ git rebase upstream/develop |
| 52 | + |
| 53 | +2. For a tiny patch, create a new branch with an explicit name: |
| 54 | + |
| 55 | + $ git checkout -b <my_branch> |
| 56 | + |
| 57 | + Alternatively, if you are working on a feature which would need more work, |
| 58 | + you can create a feature branch with `git-flow`: |
| 59 | + |
| 60 | + $ git flow feature start <my_feature> |
| 61 | + |
| 62 | + *Note: always open an issue and ask before starting a big feature, to avoid |
| 63 | + it not beeing merged and your time lost.* |
| 64 | + |
| 65 | +3. Work on your feature (don’t forget to write tests): |
| 66 | + |
| 67 | + # Some work |
| 68 | + $ git commit -am "My first change" |
| 69 | + # Some work |
| 70 | + $ git commit -am "My second change" |
| 71 | + ... |
| 72 | + |
| 73 | +4. When your feature is ready, feel free to use |
| 74 | + [interactive rebase](https://help.github.com/articles/about-git-rebase/) so |
| 75 | + your history looks clean and is easy to follow. Then, apply the last |
| 76 | + upstream changes on `develop` to prepare integration: |
| 77 | + |
| 78 | + $ git checkout develop |
| 79 | + $ git fetch --all --prune |
| 80 | + $ git rebase upstream/develop |
| 81 | + |
| 82 | +5. If there were commits on `develop` since the beginning of your feature |
| 83 | + branch, integrate them by **rebasing** if your branch has few commits, or |
| 84 | + merging if you had a long-lived branch: |
| 85 | + |
| 86 | + $ git checkout <my_feature_branch> |
| 87 | + $ git rebase develop |
| 88 | + |
| 89 | + *Note: the only case you should merge is when you are working on a big |
| 90 | + feature. If it is the case, we should have discussed this before as stated |
| 91 | + above.* |
| 92 | + |
| 93 | +6. Run the tests to ensure there is no regression and all works as expected: |
| 94 | + |
| 95 | + $ cargo test |
| 96 | + |
| 97 | +7. If it’s all good, open a pull request to merge your branch into the `develop` |
| 98 | + branch on the main repository. |
| 99 | + |
| 100 | +## Coding style |
| 101 | + |
| 102 | +Please format your code with `rustfmt`. |
0 commit comments