|
4 | 4 | LLVM GitHub User Guide
|
5 | 5 | ======================
|
6 | 6 |
|
| 7 | +.. contents:: |
| 8 | + :local: |
| 9 | + |
7 | 10 | Introduction
|
8 | 11 | ============
|
9 | 12 | The LLVM Project uses `GitHub <https://github.com/>`_ for
|
@@ -119,6 +122,97 @@ you won't encounter merge conflicts when landing the PR.
|
119 | 122 | collaborating with others on a single branch, be careful how and when you push
|
120 | 123 | changes. ``--force-with-lease`` may be useful in this situation.
|
121 | 124 |
|
| 125 | +Approvals |
| 126 | +--------- |
| 127 | + |
| 128 | +Before merging a PR you must have the required approvals. See |
| 129 | +:ref:`lgtm_how_a_patch_is_accepted` for more details. |
| 130 | + |
| 131 | +Landing your change |
| 132 | +------------------- |
| 133 | + |
| 134 | +After your PR is approved, ensure that: |
| 135 | + |
| 136 | + * The PR title and description describe the final changes. These will be used |
| 137 | + as the title and message of the final squashed commit. The titles and |
| 138 | + messages of commits in the PR will **not** be used. |
| 139 | + * You have set a valid email address in your GitHub account, see :ref:`github-email-address`. |
| 140 | + |
| 141 | +.. note:: |
| 142 | + The LLVM Project monorepo on GitHub is configured to always use "Squash |
| 143 | + and Merge" as the pull request merge option when using the web interface. |
| 144 | + With this option, GitHub uses the PR summary as the default commit |
| 145 | + message. |
| 146 | + |
| 147 | + Users with write access who can merge PRs have a final opportunity to edit |
| 148 | + the commit title and message before merging. However, this option is not |
| 149 | + available to contributors without write access. |
| 150 | + |
| 151 | +At this point, you can merge your changes. If you do not have write permissions |
| 152 | +for the repository, the merge button in GitHub's web interface will be |
| 153 | +disabled. If this is the case, continue following the steps here but ask one of |
| 154 | +your reviewers to click the merge button on your behalf. |
| 155 | + |
| 156 | +If the PR is a single commit, all you need to do is click the merge button in |
| 157 | +GitHub's web interface. |
| 158 | + |
| 159 | +If your PR contains multiple commits, you need to consolidate those commits into |
| 160 | +one commit. There are three different ways to do this, shown here with the most |
| 161 | +commonly used first: |
| 162 | + |
| 163 | +* Use the button `Squash and merge` in GitHub's web interface, if you do this |
| 164 | + remember to review the commit message when prompted. |
| 165 | + |
| 166 | + Afterwards you can select the option `Delete branch` to delete the branch |
| 167 | + from your fork. |
| 168 | + |
| 169 | +* `Interactive rebase <https://git-scm.com/docs/git-rebase#_interactive_mode>`_ |
| 170 | + with fixups. This is the recommended method since you can control the final |
| 171 | + commit message and check that the final commit looks as you expect. When |
| 172 | + your local state is correct, remember to force-push to your branch and press |
| 173 | + the merge button in GitHub's web interface afterwards. |
| 174 | + |
| 175 | +* Merge using the GitHub command line interface. Switch to your branch locally |
| 176 | + and run: |
| 177 | + |
| 178 | + :: |
| 179 | + |
| 180 | + gh pr merge --squash --delete-branch |
| 181 | + |
| 182 | + If you observe an error message from the above informing you that your pull |
| 183 | + request is not mergeable, then that is likely because upstream has been |
| 184 | + modified since your pull request was authored in a way that now results in a |
| 185 | + merge conflict. You must first resolve this merge conflict in order to merge |
| 186 | + your pull request. In order to do that: |
| 187 | + |
| 188 | + :: |
| 189 | + |
| 190 | + git fetch upstream |
| 191 | + git rebase upstream/main |
| 192 | + |
| 193 | + Then fix the source files causing merge conflicts and make sure to rebuild and |
| 194 | + retest the result. Then: |
| 195 | + |
| 196 | + :: |
| 197 | + |
| 198 | + git add <files with resolved merge conflicts> |
| 199 | + git rebase --continue |
| 200 | + |
| 201 | + Finally, you'll need to force push to your branch one more time before you can |
| 202 | + merge: |
| 203 | + |
| 204 | + :: |
| 205 | + |
| 206 | + git push --force |
| 207 | + gh pr merge --squash --delete-branch |
| 208 | + |
| 209 | + This force push may ask if you intend to push hundreds, or potentially |
| 210 | + thousands of patches (depending on how long it's been since your pull request |
| 211 | + was initially authored vs. when you intended to merge it). Since you're pushing |
| 212 | + to a branch in your fork, this is ok and expected. Github's UI for the pull |
| 213 | + request will understand that you're rebasing just your patches, and display |
| 214 | + this result correctly with a note that a force push did occur. |
| 215 | + |
122 | 216 | .. _github_branches:
|
123 | 217 |
|
124 | 218 | Branches
|
@@ -218,99 +312,6 @@ If you didn't do the above and Graphite created non-prefixed branches, a simple
|
218 | 312 | unblock is to rename (``git -m <old name> <new name>``), and then checkout the branch
|
219 | 313 | and ``gt track``.
|
220 | 314 |
|
221 |
| - |
222 |
| -Approvals |
223 |
| ---------- |
224 |
| - |
225 |
| -Before merging a PR you must have the required approvals. See |
226 |
| -:ref:`lgtm_how_a_patch_is_accepted` for more details. |
227 |
| - |
228 |
| - |
229 |
| -Landing your change |
230 |
| -------------------- |
231 |
| - |
232 |
| -After your PR is approved, ensure that: |
233 |
| - |
234 |
| - * The PR title and description describe the final changes. These will be used |
235 |
| - as the title and message of the final squashed commit. The titles and |
236 |
| - messages of commits in the PR will **not** be used. |
237 |
| - * You have set a valid email address in your GitHub account, see :ref:`github-email-address`. |
238 |
| - |
239 |
| -.. note:: |
240 |
| - The LLVM Project monorepo on GitHub is configured to always use "Squash |
241 |
| - and Merge" as the pull request merge option when using the web interface. |
242 |
| - With this option, GitHub uses the PR summary as the default commit |
243 |
| - message. |
244 |
| - |
245 |
| - Users with write access who can merge PRs have a final opportunity to edit |
246 |
| - the commit title and message before merging. However, this option is not |
247 |
| - available to contributors without write access. |
248 |
| - |
249 |
| -At this point, you can merge your changes. If you do not have write permissions |
250 |
| -for the repository, the merge button in GitHub's web interface will be |
251 |
| -disabled. If this is the case, continue following the steps here but ask one of |
252 |
| -your reviewers to click the merge button on your behalf. |
253 |
| - |
254 |
| -If the PR is a single commit, all you need to do is click the merge button in |
255 |
| -GitHub's web interface. |
256 |
| - |
257 |
| -If your PR contains multiple commits, you need to consolidate those commits into |
258 |
| -one commit. There are three different ways to do this, shown here with the most |
259 |
| -commonly used first: |
260 |
| - |
261 |
| -* Use the button `Squash and merge` in GitHub's web interface, if you do this |
262 |
| - remember to review the commit message when prompted. |
263 |
| - |
264 |
| - Afterwards you can select the option `Delete branch` to delete the branch |
265 |
| - from your fork. |
266 |
| - |
267 |
| -* `Interactive rebase <https://git-scm.com/docs/git-rebase#_interactive_mode>`_ |
268 |
| - with fixups. This is the recommended method since you can control the final |
269 |
| - commit message and check that the final commit looks as you expect. When |
270 |
| - your local state is correct, remember to force-push to your branch and press |
271 |
| - the merge button in GitHub's web interface afterwards. |
272 |
| - |
273 |
| -* Merge using the GitHub command line interface. Switch to your branch locally |
274 |
| - and run: |
275 |
| - |
276 |
| - :: |
277 |
| - |
278 |
| - gh pr merge --squash --delete-branch |
279 |
| - |
280 |
| - If you observe an error message from the above informing you that your pull |
281 |
| - request is not mergeable, then that is likely because upstream has been |
282 |
| - modified since your pull request was authored in a way that now results in a |
283 |
| - merge conflict. You must first resolve this merge conflict in order to merge |
284 |
| - your pull request. In order to do that: |
285 |
| - |
286 |
| - :: |
287 |
| - |
288 |
| - git fetch upstream |
289 |
| - git rebase upstream/main |
290 |
| - |
291 |
| - Then fix the source files causing merge conflicts and make sure to rebuild and |
292 |
| - retest the result. Then: |
293 |
| - |
294 |
| - :: |
295 |
| - |
296 |
| - git add <files with resolved merge conflicts> |
297 |
| - git rebase --continue |
298 |
| - |
299 |
| - Finally, you'll need to force push to your branch one more time before you can |
300 |
| - merge: |
301 |
| - |
302 |
| - :: |
303 |
| - |
304 |
| - git push --force |
305 |
| - gh pr merge --squash --delete-branch |
306 |
| - |
307 |
| - This force push may ask if you intend to push hundreds, or potentially |
308 |
| - thousands of patches (depending on how long it's been since your pull request |
309 |
| - was initially authored vs. when you intended to merge it). Since you're pushing |
310 |
| - to a branch in your fork, this is ok and expected. Github's UI for the pull |
311 |
| - request will understand that you're rebasing just your patches, and display |
312 |
| - this result correctly with a note that a force push did occur. |
313 |
| - |
314 | 315 | Pre-merge Continuous Integration (CI)
|
315 | 316 | -------------------------------------
|
316 | 317 |
|
|
0 commit comments