@@ -138,3 +138,45 @@ git reset --hard feat/new-thing
138
138
git stash apply
139
139
git stash drop
140
140
```
141
+
142
+ ### Anticipating a Merge
143
+
144
+ - Often in a developers workflow, they create on PR, then while waiting for review
145
+ work on another PR.
146
+ - If ` PR-2 ` relies on work from ` PR-1 ` to be merged, this can be an issue.
147
+ - One approach to solving this dilemma is informally called 'anticipating a merge'.
148
+
149
+ #### Anticipating a Merge Workflow
150
+
151
+ 1 . Complete work on branch ` PR-1 ` and push to create a PR.
152
+
153
+ 2 . Ensure you are on branch ` PR-1 ` :
154
+
155
+ ``` bash
156
+ git checkout pr-1
157
+ ```
158
+
159
+ 3 . Create branch ` PR-2 ` ** based off** ` PR-1 ` :
160
+
161
+ ``` bash
162
+ git checkout -b pr-2
163
+ ```
164
+
165
+ 4 . Build your feature on top of the code in ` PR-1 ` .
166
+ 5 . Complete work on branch ` PR-2 ` and push to create a PR.
167
+
168
+ ** Important Notes** :
169
+
170
+ - The new ` PR-2 ` will initially include the commits from ` PR-1 ` .
171
+ - However, the commits shown in the PR changelog will disappear once ` PR-1 ` is merged
172
+ into the target branch (e.g. ` development ` ).
173
+ - You should mention in the ` PR-2 ` description that this PR 'relies on PR-1 being
174
+ accepted and merged'.
175
+
176
+ #### Updating PR-1 While PR-2 Is In Progress
177
+
178
+ - You may encounter a situation where the review of ` PR-1 ` takes some time.
179
+ - If ` PR-2 ` makes progress, but the reviewer says that ` PR-1 ` requires updates.
180
+ - In this case you have two options:
181
+ - Merge ` PR-1 ` and add the required updates to ` PR-2 ` .
182
+ - Update ` PR-1 ` and merge, then rebase ` PR-2 ` against the target branch.
0 commit comments