Skip to content

Commit dc48722

Browse files
GODRIVER-3550 Update Documentation for Go Driver Branching and Merge … (#2045)
1 parent b73df4e commit dc48722

File tree

1 file changed

+119
-2
lines changed

1 file changed

+119
-2
lines changed

docs/CONTRIBUTING.md

Lines changed: 119 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ If any tests do not pass, or relevant tests are not included, the patch will not
3030

3131
If you are working on a bug or feature listed in Jira, please include the ticket number prefixed with GODRIVER in the commit message and GitHub pull request title, (e.g. GODRIVER-123). For the patch commit message itself, please follow the [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/) guide.
3232

33-
\=======
34-
3533
### Linting on commit
3634

3735
The Go team uses [pre-commit](https://pre-commit.com/#installation) to lint both source and text files.
@@ -49,6 +47,125 @@ After that, the checks will run on any changed files when committing. To manual
4947
pre-commit run --all-files
5048
```
5149

50+
### Merge up GitHub Action
51+
52+
PR [#1962](https://github.com/mongodb/mongo-go-driver/pull/1962) added the "Merge up" GitHub Actions workflow to automatically roll changes from old branches into new ones. This section outlines how this process works.
53+
54+
#### Regression
55+
56+
If a regression is identified in an older branch, the fix should be applied directly to the latest
57+
release branch. Once the pull request with the fix is merged into latest, the "Merge up" GitHub Action will
58+
automatically create a pull request to merge these changes into the master branch. This ensures that all bug fixes are
59+
incorporated into the latest codebase and actively supported versions.
60+
61+
For example, suppose we have four minor release branches: release/2.0, release/2.1, release/2.2, and release/2.3. If a
62+
regression is found in the release/2.1 branch, you would create a pull request to fix the issue in the latest supported
63+
branch, release/2.3. Once this pull request is merged, the "Merge up" GitHub Action will automatically create a pull
64+
request to merge the changes from release/2.3 into the master branch. Then you can proceed to release release/2.3.latest+1.
65+
66+
```mermaid
67+
gitGraph
68+
commit tag: "Initial main setup"
69+
70+
branch release/2.0
71+
checkout release/2.0
72+
commit tag: "Initial release/2.0"
73+
74+
checkout main
75+
branch release/2.1
76+
checkout release/2.1
77+
commit tag: "Bug introduced"
78+
79+
checkout main
80+
branch release/2.2
81+
checkout release/2.2
82+
commit tag: "Initial release/2.2"
83+
84+
checkout main
85+
branch release/2.3
86+
checkout release/2.3
87+
commit tag: "Initial release/2.3"
88+
89+
checkout release/2.1
90+
commit tag: "Bug found in release/2.1"
91+
92+
checkout release/2.3
93+
commit tag: "Bug fix applied in release/2.3 (Manual PR)"
94+
95+
checkout main
96+
merge release/2.3 tag: "Merge fix from release/2.3 into master (GitHub Actions)"
97+
commit
98+
```
99+
100+
If necessary, it is also possible to apply the fix to the older branch where the bug was originally found. In our example,
101+
once the pull request is merged into release/2.1, the "Merge up" GitHub Action will initiate a series of pull requests
102+
to roll the fix forward: first into release/2.2, then into release/2.3, and finally into master. This process makes sure
103+
that the change cascades through every intermediate supported version.
104+
105+
```mermaid
106+
gitGraph
107+
commit tag: "Initial main setup"
108+
109+
branch release/2.0
110+
checkout release/2.0
111+
commit tag: "Initial release/2.0"
112+
113+
checkout main
114+
branch release/2.1
115+
checkout release/2.1
116+
commit tag: "Bug introduced"
117+
118+
checkout main
119+
branch release/2.2
120+
checkout release/2.2
121+
commit tag: "Initial release/2.2"
122+
123+
checkout main
124+
branch release/2.3
125+
checkout release/2.3
126+
commit tag: "Initial release/2.3"
127+
128+
checkout release/2.1
129+
commit tag: "Bug fix in release/2.1 (Manual PR)"
130+
131+
checkout release/2.2
132+
merge release/2.1 tag: "Merge fix from release/2.1 (GitHub Actions)"
133+
commit
134+
135+
checkout release/2.3
136+
merge release/2.2 tag: "Merge updates from release/2.2 (GitHub Actions)"
137+
commit
138+
139+
checkout main
140+
merge release/2.3 tag: "Merge updates from release/2.3 (GitHub Actions)"
141+
commit
142+
```
143+
144+
#### Pull Request Management
145+
146+
When the "Merge up" GitHub Action is enabled, multiple merge-up pull requests (such as PR1, PR2, and PR3) can be
147+
automatically created at the same time for different bug fixes or features that all target, for example, the
148+
release/2.x branch. At first, PR1, PR2, and PR3 exist side by side—each handling separate changes. When PR1 and PR2 are
149+
closed, the Action automatically combines their changes into PR3. This final PR3 then contains all updates,
150+
allowing you to merge everything into release/2.x+1 in a single, streamlined step.
151+
152+
```mermaid
153+
flowchart LR
154+
A[PR1: Merge up from release/2.x] --> B[Close PR1]
155+
C[PR2: Merge up from release/2.x] --> D[Close PR2]
156+
157+
B --> E[PR3: Consolidated Final Pull Request]
158+
D --> E
159+
E --> F[release/2.x+1]
160+
B[Close PR1]
161+
D[Close PR2]
162+
E[PR3: Includes changes from both PR1 and PR2]
163+
```
164+
165+
#### Evergreen Config Merge Strategy
166+
167+
Changes to the testing workflow should persist through all releases in a major version.
168+
52169
### Cherry-picking between branches
53170

54171
#### Using the GitHub App

0 commit comments

Comments
 (0)