|
| 1 | +## Git |
| 2 | + |
| 3 | +### Basic Foundation |
| 4 | + |
| 5 | +Any branching strategies or approaches adopted in the repository should extend from the Basic Foundation: |
| 6 | + |
| 7 | +#### Commit often and push frequently |
| 8 | + |
| 9 | +* Help roll back to a specific good point in time |
| 10 | +* Helps share work to: test, get feedback, identify dependencies. |
| 11 | +* Provides context |
| 12 | + [GitLab - Commit often and push frequently](https://docs.gitlab.com/ee/topics/gitlab_flow.html#commit-often-and-push-frequently) |
| 13 | + |
| 14 | +#### Feature branch serves the developer. |
| 15 | + |
| 16 | +* It can contain any raw and not ready-made code |
| 17 | +* It is not stable and can be changed or deleted by the developer at any time |
| 18 | +* Internal commits should primarily help the developer. |
| 19 | + |
| 20 | +#### Pull request is a confirmation from the developer that everything is ready. |
| 21 | + |
| 22 | +* Acceptance criteria met |
| 23 | +* Definition of Done met |
| 24 | +* Tests completed successfully |
| 25 | +* The developer is ready to receive feedback from the reviewers |
| 26 | + |
| 27 | +#### The main branch of the project should always be tested and stable |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +### Recommended branching strategies: |
| 32 | + |
| 33 | +* [GitLab Flow](https://docs.gitlab.com/ee/topics/gitlab_flow.html) |
| 34 | +* [Git Flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) |
| 35 | +* [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow) |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +### Feature branch recommendations |
| 40 | + |
| 41 | +* Should have a short life. |
| 42 | +* Should contain only one Feature. |
| 43 | +* Should represent changes from one and only one developer. |
| 44 | +* Should frequently pull changes from main branch. |
| 45 | +* Should squash all commits before merged into main branch. |
| 46 | +* Should be removed after they are merged into main branch. |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +### Any name of feature branch should start with ticket id |
| 51 | + |
| 52 | +Availability of ticket id in name of the feature branch, |
| 53 | +allows people and issue tracking systems (JIRA) find and show valid links to the branch in Git repo. |
| 54 | +The best way to do this - is to create a branch for development directly from issue tracking systems. |
| 55 | +Examples of branch names: ```OOPP-76-some-feature```, ```EX-2391-some-feature```... |
| 56 | + |
| 57 | +--- |
| 58 | + |
| 59 | +### Any git commit message should start with ticket id |
| 60 | + |
| 61 | +If there is a ticket id in the comment name, it will be displayed on the page of ticket in issue tracking system. |
| 62 | +Most modern editors allow you to do this automatically, or you can add git pre commit hook: |
| 63 | +[Automatically Prepend a Jira Issue ID to Git Commit](https://gist.github.com/robatron/01b9a1061e1e8b35d270) |
| 64 | + |
| 65 | +Pay attention, since all individual commits will be merged with squash, |
| 66 | +the commit text is not important. The developer himself decides which text is convenient for him. |
| 67 | +Example of commit: ```[OOR-76] add some component``` |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### Recommended workflow for Task |
| 72 | + |
| 73 | +1. The task is taken for development in the current iteration. |
| 74 | +2. __Developer__ creates a feature branch through issue tracking systems (JIRA) from develop branch. |
| 75 | +3. __Developer__ writes the code and unit tests only in the feature branch. |
| 76 | +4. __Developer__ merges all new changes from develop branch into his feature branch and resolve all conflicts. |
| 77 | +5. __Developer__ do smoke testing. |
| 78 | +6. __Developer__ create in Pull Request to develop branch, and add at least one __Reviewer__. |
| 79 | +7. __Developer__ informs the __Reviewer__ that Pull Request is pending approval for feature branch. |
| 80 | +8. __Tester__ checks all acceptance criteria for the task, |
| 81 | + and performs integration testing of the features. |
| 82 | + Launches automated tests. |
| 83 | +9. __Reviewer__ looks through the code and with the help of comments in the Pull Request can leave comments on improving |
| 84 | + the code. |
| 85 | + The __Reviewer__ informs the __Developer__ that the review is complete. |
| 86 | + If necessary, __Developer__ makes edits and returns to step #3 |
| 87 | +10. __Developer__ merges feature branch into the development branch and squash commits. |
| 88 | +11. __Tester__ creates a task to complete automated end-to-end testing and performs it in an independent workflow. |
| 89 | + (Steps #7 and #8 can be executed in parallel or reversed.) |
| 90 | + |
| 91 | +### Recommended workflow for Integration |
| 92 | + |
| 93 | +It is recommended to use the integration branch |
| 94 | +if the work involves the development of changes by several developers in parallel |
| 95 | +and its release together. |
| 96 | + |
| 97 | +1. Tasks are accepted for development in the current iteration and distributed among the developers. |
| 98 | +2. __Lead__ creates an integration branch from the development branch. |
| 99 | +3. __Developer__ creates a feature branch through issue tracking systems (JIRA) from __integration__ branch. |
| 100 | +4. __Developer__ perform regular "workflow for Task" in feature branch. |
| 101 | +5. __Lead__ merges all new changes from develop branch into iteration branch and resolve all conflicts. |
| 102 | +6. __Developer__ merges all new changes from iteration branch into his feature branch and resolve all conflicts. |
| 103 | +7. __Lead__ create in Pull Request to develop branch, and add at least one __Reviewer__. |
| 104 | +8. __Lead__ informs the __Reviewer__ that Pull Request is pending approval for integration branch. |
| 105 | +9. __Tester__ checks all acceptance criteria for the task, |
| 106 | + and performs integration testing of the features. |
| 107 | + Launches automated tests. |
| 108 | +10. __Reviewer__ looks through the code and with the help of comments in the Pull Request can leave comments on |
| 109 | + improving the code. |
| 110 | + The __Reviewer__ informs the __Lead__ that the review is complete. |
| 111 | + If necessary, __Lead__ makes edits and returns to step #3 |
| 112 | +11. __Lead__ merges iteration branch into the development branch WITHOUT squash commits. |
| 113 | + |
| 114 | +--- |
| 115 | +Copyright © 2017 Stanislav Kochenkov |
0 commit comments