| 3 | |
| 4 | == Overview == |
| 5 | |
| 6 | In the past, we had students send pull requests directly to the main repository. This led to voluminous and frequent |
| 7 | interruptions of the folks who approve submissions to the main repository. We would like to avoid this. Our intent is |
| 8 | to have mentors do complete code reviews of students' work, and assure that submissions work properly, pass tests, |
| 9 | are correctly formatted, have no conflicts, and are mergeable. We would also like to batch the submissions to the |
| 10 | main repository -- combine students' work over several days into one already-reviewed bundle, and submit that as one PR. |
| 11 | |
| 12 | After some head-scratching, discussion, and trial runs with help of GCI students, here is what we are doing. |
| 13 | It may sound complicated, but it is designed to avoid issues we encountered with a less formal procedure, in |
| 14 | which mentors and students were freely updating from the main repository, without coordination. |
| 15 | |
| 16 | We will be using a !GitHub repository just for GCI, rather than submitting code directly to the main repository. |
| 17 | The GCI repository is:[[br]] |
| 18 | https://github.com/edengci/eden |
| 19 | |
| 20 | Students will still fork the main repository, looking forward to when they will (we hope) be contributing beyond GCI. |
| 21 | However, during GCI, they will submit PRs to the GCI repository. In order to avoid chaos, we will temporarily freeze |
| 22 | the revision level on which students will work -- we will provide a base branch that students will use to populate |
| 23 | their local working branch for GCI tasks. Students will each have their own branch in the GCI repository to send PRs to |
| 24 | so reviews and merging of PRs for each student can be done asynchronously. |
| 25 | |
| 26 | We will also have a staging branch, initially set to the same revision as the base branch, onto which student work is |
| 27 | aggregated. As mentors accept pull requests, they will merge them into the staging branch. If there is a conflict at |
| 28 | this point, it will be with some other student's work, not with an update from the main repository. The mentor can |
| 29 | resolve the conflict (which the student's assistance if needed). |
| 30 | |
| 31 | Every few days, we will switch to a fresh base branch. Students can continue with PR reviews already in progress on |
| 32 | their current branches, but when they are done with that PR, they can rename their current local branch (if they want) |
| 33 | and pull a fresh local branch from the fresh GCI base branch. We can rename students' branches in the GCI repository |
| 34 | (in case we need to refer to them) or just remove them (if it's safe), and students can push their new branches. At |
| 35 | this point, all branch names will be as they were before, and work can continue as before. |
| 36 | |
| 37 | Also at this point, students' completed PRs are on the staging branch. A designated mentor will prepare the staging |
| 38 | branch for a PR to the main repository: If the staging branch is not mergeable, the mentor can pull the staging branch |
| 39 | to their local repository, merge from the main repository, fix up conflicts, and push to the staging branch again. |
| 40 | (Note rebase is probably not appropriate here, as that would require modifying students' commits. It is better to allow |
| 41 | students to have their work visible unmodified.) In any case, the combined code needs to be tested -- both running the |
| 42 | test suite and verifying that the changes still work. (To facilitate this, we can have students write what should be |
| 43 | done to exercise their change. We can rotate this mentor task, or free up one mentor from other work, and allow them to |
| 44 | be the git-meister, as this step may take some time.) |
| 45 | |
| 46 | Everyone involved -- students with submitted code and the mentors who reviewed it -- can help get that PR accepted into |
| 47 | the main repository. |
| 48 | |
| 49 | == Setup == |
| 50 | |
| 51 | == Mentor Workflow == |
| 52 | |
| 53 | == Student Workflow == |
| 54 | |
| 55 | We will be using a !GitHub repository just for GCI, rather than submitting code directly to the main repository. |
| 56 | This will help us conserve the time of the (very busy) folks who have to approve submissions to the main repository. |
| 57 | |
| 58 | You'll use the GCI repository to use for pull requests.[[br]] |
| 59 | https://github.com/edengci/eden |
| 60 | |
| 61 | But you should still fork the main repository to create your own repository, and then clone your own repository.[[br]] |
| 62 | https://github.com/flavour/eden |
| 63 | |
| 64 | On your local (cloned) repository, set up a "remote" that points to the GCI repository. Open the repository page:[[br]] |
| 65 | https://github.com/edengci/eden [[br]] |
| 66 | On the right, there will be a box that says "SSH clone URL" or "HTTPS clone URL" -- that will be the URL to use for your new remote. |
| 67 | If you are using git from the command line, cd to your local eden repository, and do this if you are using a password to connect |
| 68 | to !GitHub (this is the "HTTPS clone URL"): |
| 69 | {{{ |
| 70 | git remote add edengci https://github.com/edengci/eden.git |
| 71 | }}} |
| 72 | Or do this if you are using SSH keys to connect to !GitHub (this is the "SSH clone URL"): |
| 73 | {{{ |
| 74 | git remote add edengci git@github.com:edengci/eden.git |
| 75 | }}} |
| 76 | |
| 77 | A mentor will create a branch with your name or nick in that GCI repository to receive your pull requests. You can get a |
| 78 | copy of this branch by doing this (replace abcde with your branch name): |
| 79 | {{{ |
| 80 | git pull edengci abcde:abcde |
| 81 | }}} |
| 82 | |
| 83 | Every few days, we switch to updated branches, and submit a combined PR, with all student work for those days, to the main |
| 84 | repository. (Even with this extra step, your commits will have your name on them, and will show up in the main repository.) |
| 85 | The mentor reviewing or approving your task should tell you went to switch, but you can ask, to be sure. The mentor will |
| 86 | update your branch in the GCI repository. You can rename the branch you were using locally for GCI work, just to be safe: |
| 87 | {{{ |
| 88 | git branch -m abcde abcde_backup |
| 89 | }}} |
| 90 | Then redo the above pull to get another, updated, branch with your name. |
| 91 | |
| 92 | The steps to submit your work as a PR are similar to those in the git wiki page linked above -- differences are noted here. |
| 93 | * "Squash" your commits into one. |
| 94 | * ''This is different:'' Don't rebase from the main repository -- you started with the right revision from the GCI branch, so don't need to update. |
| 95 | (The mentors will rebase from the main repository while they are getting ready to send the combined PR.) |
| 96 | * Push your commit to your Eden repository on !GitHub. |
| 97 | * Open the !GitHub page for your Eden repository. |
| 98 | * Click the "Compare and Create Pull Request" button shown on that commit. |
| 99 | * ''This is different:'' The pull request page has a line that shows which repository and branch you are sending the pull request too. |
| 100 | You will need to change both, to the GCI repository and your branch name in the GCI repository. |
| 101 | * There will be a down-arrow next to the repository -- that will give you a list of repositories. Select the GCI repository. |
| 102 | * Then use the down-arrow on the branch -- select your branch. |
| 103 | * Create the pull request. |
| 104 | * Continue with the code review as usual. |