163b29114STobias Hieta.. _github-reviews: 263b29114STobias Hieta 39cb0605cSTom Stellard====================== 49cb0605cSTom StellardLLVM GitHub User Guide 59cb0605cSTom Stellard====================== 69cb0605cSTom Stellard 79cb0605cSTom StellardIntroduction 89cb0605cSTom Stellard============ 99cb0605cSTom StellardThe LLVM Project uses `GitHub <https://github.com/>`_ for 109cb0605cSTom Stellard`Source Code <https://github.com/llvm/llvm-project>`_, 1163b29114STobias Hieta`Releases <https://github.com/llvm/llvm-project/releases>`_, 1263b29114STobias Hieta`Issue Tracking <https://github.com/llvm/llvm-project/issues>`_., and 1363b29114STobias Hieta`Code Reviews <https://github.com/llvm/llvm-project/pulls>`_. 149cb0605cSTom Stellard 159cb0605cSTom StellardThis page describes how the LLVM Project users and developers can 169cb0605cSTom Stellardparticipate in the project using GitHub. 179cb0605cSTom Stellard 18ead50245STom StellardBranches 19ead50245STom Stellard======== 20725a0406SMehdi Amini 21725a0406SMehdi AminiIt is possible to create branches that starts with `users/<username>/`, however this is 22725a0406SMehdi Aminiintended to be able to support "stacked" pull-request. Do not create any branches in the 23725a0406SMehdi Aminillvm/llvm-project repository otherwise, please use a fork (see below). User branches that 24725a0406SMehdi Aminiaren't associated with a pull-request **will be deleted**. 25ead50245STom Stellard 266dcfc84eSMircea TrofinUsing Graphite for stacked Pull Requests 276dcfc84eSMircea Trofin======================================== 286dcfc84eSMircea Trofin 2962601250SMircea Trofin`Graphite <https://app.graphite.dev/>`_ is a stacked pull request tool supported 3062601250SMircea Trofinby the LLVM repo (the other being `reviewable.io <https://reviewable.io>`_). 316dcfc84eSMircea Trofin 3262601250SMircea TrofinGraphite will want to create branches under ``llvm/llvm-project`` rather than your 336dcfc84eSMircea Trofinprivate fork, so the guidance above, about branch naming, is critical, otherwise 3462601250SMircea Trofin``gt submit`` (i.e. publish your PRs for review) will fail. 356dcfc84eSMircea Trofin 3662601250SMircea TrofinUse ``gt config`` then ``Branch naming settings`` and ``Set a prefix for branch names``. 3762601250SMircea TrofinInclude the last ``/``. 386dcfc84eSMircea Trofin 396dcfc84eSMircea TrofinIf you didn't do the above and Graphite created non-prefixed branches, a simple way to 4062601250SMircea Trofinunblock is to rename (``git -m <old name> <new name>``), and then checkout the branch 4162601250SMircea Trofinand ``gt track``. 426dcfc84eSMircea Trofin 43245cb1f7STom StellardPull Requests 44245cb1f7STom Stellard============= 4563b29114STobias HietaThe LLVM project is using GitHub Pull Requests for Code Reviews. This document 4663b29114STobias Hietadescribes the typical workflow of creating a Pull Request and getting it reviewed 4763b29114STobias Hietaand accepted. This is meant as an overview of the GitHub workflow, for complete 4863b29114STobias Hietadocumentation refer to `GitHub's documentation <https://docs.github.com/pull-requests>`_. 4963b29114STobias Hieta 5093471466SDavid Blaikie.. note:: 5193471466SDavid Blaikie If you are using a Pull Request for purposes other than review 5293471466SDavid Blaikie (eg: precommit CI results, convenient web-based reverts, etc) 53*293dbea8SDeNiCoN add the `skip-precommit-approval <https://github.com/llvm/llvm-project/labels?q=skip-precommit-approval>`_ 5493471466SDavid Blaikie label to the PR. 5593471466SDavid Blaikie 5663b29114STobias HietaGitHub Tools 5763b29114STobias Hieta------------ 5863b29114STobias HietaYou can interact with GitHub in several ways: via git command line tools, 5963b29114STobias Hietathe web browser, `GitHub Desktop <https://desktop.github.com/>`_, or the 6063b29114STobias Hieta`GitHub CLI <https://cli.github.com>`_. This guide will cover the git command line 6163b29114STobias Hietatools and the GitHub CLI. The GitHub CLI (`gh`) will be most like the `arc` workflow and 6263b29114STobias Hietarecommended. 63245cb1f7STom Stellard 64245cb1f7STom StellardCreating Pull Requests 6563b29114STobias Hieta---------------------- 669818bf26SMehdi AminiKeep in mind that when creating a pull request, it should generally only contain one 679818bf26SMehdi Aminiself-contained commit initially. 6863b29114STobias HietaThis makes it easier for reviewers to understand the introduced changes and 6963b29114STobias Hietaprovide feedback. It also helps maintain a clear and organized commit history 7063b29114STobias Hietafor the project. If you have multiple changes you want to introduce, it's 7163b29114STobias Hietarecommended to create separate pull requests for each change. 7263b29114STobias Hieta 7363b29114STobias HietaCreate a local branch per commit you want to submit and then push that branch 7463b29114STobias Hietato your `fork <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks>`_ 75e469d0d6SPaul Robinsonof the llvm-project and 76245cb1f7STom Stellard`create a pull request from the fork <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork>`_. 773dda1040SAlex BradburyAs GitHub uses the first line of the commit message truncated to 72 characters 783dda1040SAlex Bradburyas the pull request title, you may have to edit to reword or to undo this 793dda1040SAlex Bradburytruncation. 80245cb1f7STom Stellard 8163b29114STobias HietaCreating Pull Requests with GitHub CLI 8263b29114STobias Hieta^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 8363b29114STobias HietaWith the CLI it's enough to create the branch locally and then run: 8463b29114STobias Hieta 8563b29114STobias Hieta:: 8663b29114STobias Hieta 8763b29114STobias Hieta gh pr create 8863b29114STobias Hieta 8963b29114STobias HietaWhen prompted select to create and use your own fork and follow 9063b29114STobias Hietathe instructions to add more information needed. 9163b29114STobias Hieta 9263b29114STobias Hieta.. note:: 9363b29114STobias Hieta 9463b29114STobias Hieta When you let the GitHub CLI create a fork of llvm-project to 9563b29114STobias Hieta your user, it will change the git "remotes" so that "origin" points 9663b29114STobias Hieta to your fork and "upstream" points to the main llvm-project repository. 9763b29114STobias Hieta 98245cb1f7STom StellardUpdating Pull Requests 9963b29114STobias Hieta---------------------- 10063b29114STobias HietaIn order to update your pull request, the only thing you need to do is to push 10163b29114STobias Hietayour new commits to the branch in your fork. That will automatically update 10263b29114STobias Hietathe pull request. 10363b29114STobias Hieta 104245cb1f7STom StellardWhen updating a pull request, you should push additional "fix up" commits to 105245cb1f7STom Stellardyour branch instead of force pushing. This makes it easier for GitHub to 10663b29114STobias Hietatrack the context of previous review comments. Consider using the 10763b29114STobias Hieta`built-in support for fixups <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt>`_ 10863b29114STobias Hietain git. 109245cb1f7STom Stellard 11063b29114STobias HietaIf you do this, you must squash and merge before landing the PR and 111245cb1f7STom Stellardyou must use the pull request title and description as the commit message. 11263b29114STobias HietaYou can do this manually with an interactive git rebase or with GitHub's 11363b29114STobias Hietabuilt-in tool. See the section about landing your fix below. 11463b29114STobias Hieta 11563b29114STobias HietaWhen pushing to your branch, make sure you push to the correct fork. Check your 11663b29114STobias Hietaremotes with: 11763b29114STobias Hieta 11863b29114STobias Hieta:: 11963b29114STobias Hieta 12063b29114STobias Hieta git remote -v 12163b29114STobias Hieta 12263b29114STobias HietaAnd make sure you push to the remote that's pointing to your fork. 12363b29114STobias Hieta 12463b29114STobias HietaRebasing Pull Requests and Force Pushes 12563b29114STobias Hieta--------------------------------------- 12663b29114STobias HietaIn general, you should avoid rebasing a Pull Request and force pushing to the 12763b29114STobias Hietabranch that's the root of the Pull Request during the review. This action will 12863b29114STobias Hietamake the context of the old changes and comments harder to find and read. 12963b29114STobias Hieta 13063b29114STobias HietaSometimes, a rebase might be needed to update your branch with a fix for a test 13163b29114STobias Hietaor in some dependent code. 13263b29114STobias Hieta 13363b29114STobias HietaAfter your PR is reviewed and accepted, you want to rebase your branch to ensure 13463b29114STobias Hietayou won't encounter merge conflicts when landing the PR. 13563b29114STobias Hieta 136dfc40650SDavid Spickett.. note:: 137dfc40650SDavid Spickett This guide assumes that the PR branch only has 1 author. If you are 138dfc40650SDavid Spickett collaborating with others on a single branch, be careful how and when you push 139dfc40650SDavid Spickett changes. ``--force-with-lease`` may be useful in this situation. 140dfc40650SDavid Spickett 141a1c6dc22SDavid SpickettApprovals 142a1c6dc22SDavid Spickett--------- 143a1c6dc22SDavid Spickett 144a1c6dc22SDavid SpickettBefore merging a PR you must have the required approvals. See 145a1c6dc22SDavid Spickett:ref:`lgtm_how_a_patch_is_accepted` for more details. 146a1c6dc22SDavid Spickett 14763b29114STobias HietaLanding your change 14863b29114STobias Hieta------------------- 14963b29114STobias Hieta 150a1c6dc22SDavid SpickettWhen your PR has been approved you can merge your changes. 15163b29114STobias Hieta 152dfc40650SDavid SpickettIf you do not have write permissions for the repository, the merge button in 153dfc40650SDavid SpickettGitHub's web interface will be disabled. If this is the case, continue following 154dfc40650SDavid Spickettthe steps here but ask one of your reviewers to click the merge button on your 155dfc40650SDavid Spickettbehalf. 156dfc40650SDavid Spickett 157dfc40650SDavid SpickettIf the PR is a single commit, all you need to do is click the merge button in 158dfc40650SDavid SpickettGitHub's web interface. 159dfc40650SDavid Spickett 160dfc40650SDavid SpickettIf your PR contains multiple commits, you need to consolidate those commits into 161dfc40650SDavid Spickettone commit. There are three different ways to do this, shown here with the most 162dfc40650SDavid Spickettcommonly used first: 163dfc40650SDavid Spickett 164dfc40650SDavid Spickett* Use the button `Squash and merge` in GitHub's web interface, if you do this 16563b29114STobias Hieta remember to review the commit message when prompted. 16663b29114STobias Hieta 16763b29114STobias Hieta Afterwards you can select the option `Delete branch` to delete the branch 16863b29114STobias Hieta from your fork. 16963b29114STobias Hieta 170dfc40650SDavid Spickett* `Interactive rebase <https://git-scm.com/docs/git-rebase#_interactive_mode>`_ 171dfc40650SDavid Spickett with fixups. This is the recommended method since you can control the final 172dfc40650SDavid Spickett commit message and check that the final commit looks as you expect. When 173dfc40650SDavid Spickett your local state is correct, remember to force-push to your branch and press 174dfc40650SDavid Spickett the merge button in GitHub's web interface afterwards. 175dfc40650SDavid Spickett 176dfc40650SDavid Spickett* Merge using the GitHub command line interface. Switch to your branch locally 177dfc40650SDavid Spickett and run: 17863b29114STobias Hieta 17963b29114STobias Hieta :: 18063b29114STobias Hieta 18163b29114STobias Hieta gh pr merge --squash --delete-branch 18263b29114STobias Hieta 183102715a6SNick Desaulniers If you observe an error message from the above informing you that your pull 184102715a6SNick Desaulniers request is not mergeable, then that is likely because upstream has been 185102715a6SNick Desaulniers modified since your pull request was authored in a way that now results in a 186102715a6SNick Desaulniers merge conflict. You must first resolve this merge conflict in order to merge 187102715a6SNick Desaulniers your pull request. In order to do that: 188102715a6SNick Desaulniers 189102715a6SNick Desaulniers :: 190102715a6SNick Desaulniers 191102715a6SNick Desaulniers git fetch upstream 192102715a6SNick Desaulniers git rebase upstream/main 193102715a6SNick Desaulniers 194102715a6SNick Desaulniers Then fix the source files causing merge conflicts and make sure to rebuild and 195102715a6SNick Desaulniers retest the result. Then: 196102715a6SNick Desaulniers 197102715a6SNick Desaulniers :: 198102715a6SNick Desaulniers 199102715a6SNick Desaulniers git add <files with resolved merge conflicts> 200102715a6SNick Desaulniers git rebase --continue 201102715a6SNick Desaulniers 202102715a6SNick Desaulniers Finally, you'll need to force push to your branch one more time before you can 203102715a6SNick Desaulniers merge: 204102715a6SNick Desaulniers 205102715a6SNick Desaulniers :: 206102715a6SNick Desaulniers 207dfc40650SDavid Spickett git push --force 2080bfaed8cSBjorn Pettersson gh pr merge --squash --delete-branch 209102715a6SNick Desaulniers 210102715a6SNick Desaulniers This force push may ask if you intend to push hundreds, or potentially 211102715a6SNick Desaulniers thousands of patches (depending on how long it's been since your pull request 212102715a6SNick Desaulniers was initially authored vs. when you intended to merge it). Since you're pushing 213102715a6SNick Desaulniers to a branch in your fork, this is ok and expected. Github's UI for the pull 214102715a6SNick Desaulniers request will understand that you're rebasing just your patches, and display 215102715a6SNick Desaulniers this result correctly with a note that a force push did occur. 216102715a6SNick Desaulniers 21763b29114STobias Hieta 218b1359221SMehdi AminiPre-merge Continuous Integration (CI) 219b1359221SMehdi Amini------------------------------------- 220b1359221SMehdi Amini 221b1359221SMehdi AminiMultiple checks will be applied on a pull-request, either for linting/formatting 222b1359221SMehdi Aminior some build and tests. None of these are perfect and you will encounter 223b1359221SMehdi Aminifalse positive, infrastructure failures (unstable or unavailable worker), or 224b1359221SMehdi Aminiyou will be unlucky and based your change on a broken revision of the main branch. 225b1359221SMehdi Amini 226b1359221SMehdi AminiNone of the checks are strictly mandatory: these are tools to help us build a 227b1359221SMehdi Aminibetter codebase and be more productive (by avoiding issues found post-merge and 228b1359221SMehdi Aminipossible reverts). As a developer you're empowered to exercise your judgement 229b1359221SMehdi Aminiabout bypassing any of the checks when merging code. 230b1359221SMehdi Amini 231b1359221SMehdi AminiThe infrastructure can print messages that make it seem like these are mandatory, 232b1359221SMehdi Aminibut this is just an artifact of GitHub infrastructure and not a policy of the 233b1359221SMehdi Aminiproject. 234b1359221SMehdi Amini 235b1359221SMehdi AminiHowever, please make sure you do not force-merge any changes that have clear 236b1359221SMehdi Aminitest failures directly linked to your changes. Our policy is still to keep the 237b1359221SMehdi Amini``main`` branch in a good condition, and introducing failures to be fixed later 238b1359221SMehdi Aminiviolates that policy. 239b1359221SMehdi Amini 2403df262f8SDavid SpickettProblems After Landing Your Change 2413df262f8SDavid Spickett================================== 2423df262f8SDavid Spickett 2433df262f8SDavid SpickettEven though your PR passed the pre-commit checks and is approved by reviewers, it 2443df262f8SDavid Spickettmay cause problems for some configurations after it lands. You will be notified 2453df262f8SDavid Spickettif this happens and the community is ready to help you fix the problems. 2463df262f8SDavid Spickett 2473df262f8SDavid SpickettThis process is described in detail 2483df262f8SDavid Spickett:ref:`here <MyFirstTypoFix Issues After Landing Your PR>`. 2493df262f8SDavid Spickett 2503df262f8SDavid Spickett 25163b29114STobias HietaChecking out another PR locally 25263b29114STobias Hieta------------------------------- 25363b29114STobias HietaSometimes you want to review another person's PR on your local machine to run 254102715a6SNick Desaulnierstests or inspect code in your preferred editor. This is easily done with the 25563b29114STobias HietaCLI: 25663b29114STobias Hieta 25763b29114STobias Hieta:: 25863b29114STobias Hieta 25963b29114STobias Hieta gh pr checkout <PR Number> 26063b29114STobias Hieta 26163b29114STobias HietaThis is also possible with the web interface and the normal git command line 262254847fbSDavid Spicketttools, but the process is a bit more complicated. See GitHub's 26363b29114STobias Hieta`documentation <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally?platform=linux&tool=webui#modifying-an-inactive-pull-request-locally>`_ 26463b29114STobias Hietaon the topic. 26563b29114STobias Hieta 26663b29114STobias HietaExample Pull Request with GitHub CLI 26763b29114STobias Hieta==================================== 26863b29114STobias HietaHere is an example for creating a Pull Request with the GitHub CLI: 26963b29114STobias Hieta 27063b29114STobias Hieta:: 27163b29114STobias Hieta 27263b29114STobias Hieta # Clone the repo 27363b29114STobias Hieta gh repo clone llvm/llvm-project 27463b29114STobias Hieta 27563b29114STobias Hieta # Switch to the repo and create a new branch 27663b29114STobias Hieta cd llvm-project 27763b29114STobias Hieta git switch -c my_change 27863b29114STobias Hieta 27963b29114STobias Hieta # Create your changes 28063b29114STobias Hieta $EDITOR file.cpp 28163b29114STobias Hieta 28263b29114STobias Hieta # Don't forget clang-format 28363b29114STobias Hieta git clang-format 28463b29114STobias Hieta 28563b29114STobias Hieta # and don't forget running your tests 28663b29114STobias Hieta ninja check-llvm 28763b29114STobias Hieta 28863b29114STobias Hieta # Commit, use a good commit message 28963b29114STobias Hieta git commit file.cpp 29063b29114STobias Hieta 29163b29114STobias Hieta # Create the PR, select to use your own fork when prompted. 29263b29114STobias Hieta # If you don't have a fork, gh will create one for you. 29363b29114STobias Hieta gh pr create 29463b29114STobias Hieta 29563b29114STobias Hieta # If you get any review comments, come back to the branch and 29663b29114STobias Hieta # adjust them. 29763b29114STobias Hieta git switch my_change 29863b29114STobias Hieta $EDITOR file.cpp 29963b29114STobias Hieta 30063b29114STobias Hieta # Commit your changes 30163b29114STobias Hieta git commit file.cpp -m "Code Review adjustments" 30263b29114STobias Hieta 3036b6312b0SMehdi Amini # Format changes 3046b6312b0SMehdi Amini git clang-format HEAD~ 3056b6312b0SMehdi Amini 3066b6312b0SMehdi Amini # Recommit if any formatting changes 3076b6312b0SMehdi Amini git commit -a --amend 3086b6312b0SMehdi Amini 30963b29114STobias Hieta # Push your changes to your fork branch, be mindful of 31063b29114STobias Hieta # your remotes here, if you don't remember what points to your 31163b29114STobias Hieta # fork, use git remote -v to see. Usually origin points to your 31263b29114STobias Hieta # fork and upstream to llvm/llvm-project 31363b29114STobias Hieta git push origin my_change 31463b29114STobias Hieta 3156b6312b0SMehdi AminiBefore merging the PR, it is recommended that you rebase locally and re-run test 3166b6312b0SMehdi Aminichecks: 31763b29114STobias Hieta 3186b6312b0SMehdi Amini:: 3196b6312b0SMehdi Amini 3206b6312b0SMehdi Amini # Add upstream as a remote (if you don't have it already) 3216b6312b0SMehdi Amini git remote add upstream https://github.com/llvm/llvm-project.git 3226b6312b0SMehdi Amini 3236b6312b0SMehdi Amini # Make sure you have all the latest changes 3246b6312b0SMehdi Amini git fetch upstream && git rebase -i upstream/main 3256b6312b0SMehdi Amini 3266b6312b0SMehdi Amini # Make sure tests pass with latest changes and your change 3276b6312b0SMehdi Amini ninja check 3286b6312b0SMehdi Amini 3296b6312b0SMehdi Amini # Push the rebased changes to your fork. 330dfc40650SDavid Spickett git push origin my_change --force 33163b29114STobias Hieta 33263b29114STobias Hieta # Now merge it 3330bfaed8cSBjorn Pettersson gh pr merge --squash --delete-branch 33463b29114STobias Hieta 33563b29114STobias Hieta 33663b29114STobias HietaSee more in-depth information about how to contribute in the following documentation: 33763b29114STobias Hieta 33863b29114STobias Hieta* :doc:`Contributing` 33963b29114STobias Hieta* :doc:`MyFirstTypoFix` 340ead50245STom Stellard 34193cc72beSMichael MaitlandExample Pull Request with git 34293cc72beSMichael Maitland==================================== 34393cc72beSMichael Maitland 34493cc72beSMichael MaitlandInstead of using the GitHub CLI to create a PR, you can push your code to a 34593cc72beSMichael Maitlandremote branch on your fork and create the PR to upstream using the GitHub web 34693cc72beSMichael Maitlandinterface. 34793cc72beSMichael Maitland 34893cc72beSMichael MaitlandHere is an example of making a PR using git and the GitHub web interface: 34993cc72beSMichael Maitland 35093cc72beSMichael MaitlandFirst follow the instructions to [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo?tool=webui#forking-a-repository). 35193cc72beSMichael Maitland 35293cc72beSMichael MaitlandNext follow the instructions to [clone your forked repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo?tool=webui#cloning-your-forked-repository). 35393cc72beSMichael Maitland 35493cc72beSMichael MaitlandOnce you've cloned your forked repository, 35593cc72beSMichael Maitland 35693cc72beSMichael Maitland:: 35793cc72beSMichael Maitland 35893cc72beSMichael Maitland # Switch to the forked repo 35993cc72beSMichael Maitland cd llvm-project 36093cc72beSMichael Maitland 36193cc72beSMichael Maitland # Create a new branch 36293cc72beSMichael Maitland git switch -c my_change 36393cc72beSMichael Maitland 36493cc72beSMichael Maitland # Create your changes 36593cc72beSMichael Maitland $EDITOR file.cpp 36693cc72beSMichael Maitland 36793cc72beSMichael Maitland # Don't forget clang-format 36893cc72beSMichael Maitland git clang-format 36993cc72beSMichael Maitland 37093cc72beSMichael Maitland # and don't forget running your tests 37193cc72beSMichael Maitland ninja check-llvm 37293cc72beSMichael Maitland 37393cc72beSMichael Maitland # Commit, use a good commit message 37493cc72beSMichael Maitland git commit file.cpp 37593cc72beSMichael Maitland 37693cc72beSMichael Maitland # Push your changes to your fork branch, be mindful of 37793cc72beSMichael Maitland # your remotes here, if you don't remember what points to your 37893cc72beSMichael Maitland # fork, use git remote -v to see. Usually origin points to your 37993cc72beSMichael Maitland # fork and upstream to llvm/llvm-project 38093cc72beSMichael Maitland git push origin my_change 38193cc72beSMichael Maitland 38293cc72beSMichael MaitlandNavigate to the URL printed to the console from the git push command in the last step. 38393cc72beSMichael MaitlandCreate a pull request from your branch to llvm::main. 38493cc72beSMichael Maitland 38593cc72beSMichael Maitland:: 38693cc72beSMichael Maitland 38793cc72beSMichael Maitland # If you get any review comments, come back to the branch and 38893cc72beSMichael Maitland # adjust them. 38993cc72beSMichael Maitland git switch my_change 39093cc72beSMichael Maitland $EDITOR file.cpp 39193cc72beSMichael Maitland 39293cc72beSMichael Maitland # Commit your changes 39393cc72beSMichael Maitland git commit file.cpp -m "Code Review adjustments" 39493cc72beSMichael Maitland 39593cc72beSMichael Maitland # Format changes 39693cc72beSMichael Maitland git clang-format HEAD~ 39793cc72beSMichael Maitland 39893cc72beSMichael Maitland # Recommit if any formatting changes 39993cc72beSMichael Maitland git commit -a --amend 40093cc72beSMichael Maitland 40193cc72beSMichael Maitland # Re-run tests and make sure nothing broke. 40293cc72beSMichael Maitland ninja check 40393cc72beSMichael Maitland 40493cc72beSMichael Maitland # Push your changes to your fork branch, be mindful of 40593cc72beSMichael Maitland # your remotes here, if you don't remember what points to your 40693cc72beSMichael Maitland # fork, use git remote -v to see. Usually origin points to your 40793cc72beSMichael Maitland # fork and upstream to llvm/llvm-project 40893cc72beSMichael Maitland git push origin my_change 40993cc72beSMichael Maitland 41093cc72beSMichael MaitlandBefore merging the PR, it is recommended that you rebase locally and re-run test 41193cc72beSMichael Maitlandchecks: 41293cc72beSMichael Maitland 41393cc72beSMichael Maitland:: 41493cc72beSMichael Maitland 4156b6312b0SMehdi Amini # Add upstream as a remote (if you don't have it already) 41693cc72beSMichael Maitland git remote add upstream https://github.com/llvm/llvm-project.git 41793cc72beSMichael Maitland 41893cc72beSMichael Maitland # Make sure you have all the latest changes 41993cc72beSMichael Maitland git fetch upstream && git rebase -i upstream/main 42093cc72beSMichael Maitland 42193cc72beSMichael Maitland # Make sure tests pass with latest changes and your change 42293cc72beSMichael Maitland ninja check 42393cc72beSMichael Maitland 42493cc72beSMichael Maitland # Push the rebased changes to your fork. 425dfc40650SDavid Spickett git push origin my_change --force 42693cc72beSMichael Maitland 42793cc72beSMichael MaitlandOnce your PR is approved, rebased, and tests are passing, click `Squash and 42893cc72beSMichael MaitlandMerge` on your PR in the GitHub web interface. 42993cc72beSMichael Maitland 4306b6312b0SMehdi AminiSee more in-depth information about how to contribute in the following documentation: 4316b6312b0SMehdi Amini 4326b6312b0SMehdi Amini* :doc:`Contributing` 4336b6312b0SMehdi Amini* :doc:`MyFirstTypoFix` 4346b6312b0SMehdi Amini 4359cb0605cSTom StellardReleases 4369cb0605cSTom Stellard======== 4379cb0605cSTom Stellard 4389cb0605cSTom StellardBackporting Fixes to the Release Branches 43963b29114STobias Hieta----------------------------------------- 440cdc19345SAaron BallmanYou can use special comments on issues or pull requests to make backport 441cdc19345SAaron Ballmanrequests for the release branches. This is done by making a comment containing 442cdc19345SAaron Ballmanthe following command on any issue or pull request that has been added to one 443cdc19345SAaron Ballmanof the "X.Y.Z Release" milestones. 4449cb0605cSTom Stellard 4459cb0605cSTom Stellard:: 4469cb0605cSTom Stellard 4479cb0605cSTom Stellard /cherry-pick <commit> <commit> <...> 4489cb0605cSTom Stellard 4499cb0605cSTom StellardThis command takes one or more git commit hashes as arguments and will attempt 4509cb0605cSTom Stellardto cherry-pick the commit(s) to the release branch. If the commit(s) fail to 4519cb0605cSTom Stellardapply cleanly, then a comment with a link to the failing job will be added to 452cdc19345SAaron Ballmanthe issue/pull request. If the commit(s) do apply cleanly, then a pull request 453cdc19345SAaron Ballmanwill be created with the specified commits. 4549cb0605cSTom Stellard 455e99edf6bSTom StellardIf a commit you want to backport does not apply cleanly, you may resolve 456e99edf6bSTom Stellardthe conflicts locally and then create a pull request against the release 457e99edf6bSTom Stellardbranch. Just make sure to add the release milestone to the pull request. 4585bdcaf1aSLouis Dionne 4595bdcaf1aSLouis DionneGetting admin access to CI infrastructure 4605bdcaf1aSLouis Dionne========================================= 4615bdcaf1aSLouis Dionne 4625bdcaf1aSLouis DionneAny individual who is responsible for setting up and/or maintaining CI infrastructure for a LLVM project can 4635bdcaf1aSLouis Dionnerequest to be granted the CI/CD role to the LLVM organization admins. The request can be made by creating 4645bdcaf1aSLouis Dionne`a Github issue <https://github.com/llvm/llvm-project/issues/new>`_ and using the ``infrastructure`` label. 4655bdcaf1aSLouis DionneApplicants must include a justification for why the role is being requested. Applications are reviewed on a 4665bdcaf1aSLouis Dionnecase-by-case basis by the LLVM admins and the role can be revoked at any point as the LLVM admins see fit. 467