|
| 1 | +# Contributing to Java Fundamentals Course |
| 2 | + |
| 3 | +Thank you for taking the time to contribute to the open-source education! 👏 |
| 4 | + |
| 5 | +Before moving forward, please **make sure that you understand what is an exercise and how this repository is organized.** The best place to learn about that is |
| 6 | +[Introduction module](https://github.com/bobocode-projects/java-fundamentals-course/tree/main/0-0-intro#introduction) 🤓 |
| 7 | + |
| 8 | +## Branching strategy |
| 9 | + |
| 10 | +In this repository we maintain **two key branches** [main](https://github.com/bobocode-projects/java-fundamentals-course) and |
| 11 | +[completed](https://github.com/bobocode-projects/java-fundamentals-course/completed). Since the `main` branch stores the exercises, and the `completed` stores the |
| 12 | +completed solution, the latter is always ahead of the first one. Here's the rule: |
| 13 | + |
| 14 | +#### The [Completed Solution PR](https://github.com/bobocode-projects/java-fundamentals-course/pull/33) should always show only those changes that participats implement in the scope of the exercises❗️ |
| 15 | + |
| 16 | +It means two things: |
| 17 | +* any changes that are related to the exercise task, the tests, or the project configuration should be added first to the `main` branch and then merged from `main` to `completed` |
| 18 | +* only changes related to the completed solution should be added to the `completed` branch |
| 19 | + |
| 20 | +## Creating a Pull Request |
| 21 | + |
| 22 | +### PR with a small fix |
| 23 | + |
| 24 | +If case you found a mistake and want to provide a fix, you can easily create a PR with corresponding changes. |
| 25 | +Please make sure that you have read [the branching strategy](#branching-strategy) so your PR targets to the right place. |
| 26 | + |
| 27 | +### Double pull request |
| 28 | +In case you need to **change both the exercise and the completed solution**, you will need to create **two pull requests.** In order to follow [the branching strategy](#branching-strategy), |
| 29 | +you will need to do some **extra work with branches** ⚠️. |
| 30 | + |
| 31 | +Imagine you need to add a new `methodX()` to the exercise. Here's the list of actions you will need to do: |
| 32 | +1. Create a local branch from `main` (let's call it `exercise branch`) |
| 33 | +2. Add `methodX()` that throws `ExerciseNotCompletedException`, and a corresponding `testMethodX()` |
| 34 | +3. Commit these changes to the `exercise branch` |
| 35 | +4. Push the changes |
| 36 | +5. Checkout `completed` |
| 37 | +6. Create a local branch from `completed` (let's call it `solution branch`) |
| 38 | +7. Merge your `exercise branch` into the `solution brnach` |
| 39 | +8. Implement `methodX()` and make sure that tests pass |
| 40 | +9. Commit these changes to the `solution branch` |
| 41 | +10. Push the changes |
| 42 | + |
| 43 | +**If everything is fine, then you can create two pull requets:** |
| 44 | + |
| 45 | +11. Create a pull request from the `exercise branch` to the `main` |
| 46 | +12. Create a pull request from the `solution branch` to the `completed` |
| 47 | + |
| 48 | +### Branching naming convention |
| 49 | +A branch name should start from the ticket or issue number if one is avaibale, following the short changes summary. Like this: |
| 50 | + |
| 51 | +* ```101-insane-lambdas-exercise``` |
| 52 | + |
| 53 | +In case the branch targes `completed` it should has a corresponding suffix. Like this: |
| 54 | + |
| 55 | +* ```101-insane-lambdas-exercise-completed``` |
| 56 | + |
| 57 | +### Commits |
| 58 | +* In case you are working on the JIRA ticket, or the GitHub issue, please make sure that you always add its full number to every commit message |
| 59 | +* Please provide a desctiptive messages |
| 60 | +* Use squash and rebease to avoid redudntant commits |
| 61 | + |
| 62 | + |
| 63 | +## Submitting an issue |
| 64 | +In case you have faced **an issue that you couldn't resolve** and/or you have **a good idea how this repository can be improved**, feel free to [submit an issue](https://github.com/bobocode-projects/java-fundamentals-course/issues/new). |
| 65 | + |
| 66 | +Please note that **if you just have a question, you can ask it in one of the three different ways** depending on the quesiton: |
| 67 | +* add you comment to the [Completed PR](https://github.com/bobocode-projects/java-fundamentals-course/pull/33#issue-790887000) – if you want to ask about the completed solution |
| 68 | +* [start a new discussion](https://github.com/bobocode-projects/java-fundamentals-course/discussions/new) under Q&A – if you have question related to this repo |
| 69 | +* contact us via info@bobocode.com – if you have other questions |
0 commit comments