12 | | After some head-scratching, discussion, and trial runs with help of GCI students, here are two options we are considering. |
13 | | Both are designed to avoid issues we encountered with a less formal procedure, in which mentors and students were freely |
| 12 | After some head-scratching, discussion, and trial runs with help of GCI students, here is what seems to be a workable option. |
| 13 | It is designed to avoid issues we encountered with a less formal procedure, in which mentors and students were freely |
25 | | ''Optionally'', students will each have their own branch in the GCI repository to send PRs to so reviews and merging |
26 | | of PRs for each student can be done asynchronously, and so students can be released to work on other tasks more |
27 | | quickly, as they will not encounter conflicts. |
| 26 | We will also have a ''base'' branch that shows the revision that was current in the main repository's master branch |
| 27 | at the time we start a new aggregations cycle. This is present purely for convenience in identifying the common base |
| 28 | revision between the staging branch and the main repository's master branch. Students will not need to do anything with |
| 29 | the base branch. |
32 | | The two options diverge at this point: |
| 34 | Since all student work during an aggregation cycle goes to the same staging branch, other students' work will likely be |
| 35 | merged into the staging branch while a student's PR is being reviewed, so by the time the PR is ready, there may be a |
| 36 | conflict with the other students' work. The mentor will help the student with the appropriate git procedure for rebasing |
| 37 | and resolving their conflict. This is much like the normal workflow for submitting to the main repository, so students |
| 38 | will get practice with the normal git workflow. |
34 | | If we are not using separate student branches, then the target of student PRs will be the staging branch. |
35 | | In that case, other students' work will likely be merged into the staging branch while a student's PR is being reviewed, |
36 | | so by the time the PR is ready, there may be a conflict with the other students' work. The mentor will help the student |
37 | | with the appropriate git procedure for rebasing and resolving their conflict. This is much like the normal workflow |
38 | | for submitting to trunk. |
| 40 | Every few days, we will switch to fresh base and staging branches: rename the current base and staging to (say) |
| 41 | base_done and staging_done, and create new base and staging branches from the main repository's master. This is the only |
| 42 | point at which coordination with students is needed. Since we don't want to delay preparing the completed code for a PR |
| 43 | to the main repository, if there are any PRs in progress, we can close those before we rename the base and staging |
| 44 | branches, and ask students to rebase from the new staging and re-open their PR there. As the students may have merge |
| 45 | conflicts at this point, we can't automate this. |
40 | | If we are using student branches in the GCI repository, then students will do PRs to their individual branches there. |
41 | | When a mentor accepts a PR, it will be merged into the students branch in the GCI repository. Since no-one else is |
42 | | updating that branch, there will be no conflict. Mentors will then merge the student's branch into the staging branch. |
43 | | If there is a conflict at this point, it will be with some other student's work, not with an update from the main |
44 | | repository. Conflicts should be relatively easy to resolve, as commits should be small. The mentor can resolve the |
45 | | conflict, with the student's assistance if needed. |
46 | | |
47 | | Every few days, we will switch to a fresh base branch. Students can continue with PR reviews already in progress on |
48 | | their current branches, but when they are done with that PR, they can rename their current local branch (if they want) |
49 | | and pull a fresh local branch from the fresh GCI base branch. We can rename students' branches in the GCI repository |
50 | | (in case we need to refer to them) or just remove them (if it's safe), and students can push their new branches. At |
51 | | this point, all branch names will be as they were before, and work can continue as before. |
52 | | |
53 | | At this point, students' completed PRs are on the staging branch. A designated mentor will prepare the staging |
| 47 | At this point, students' completed PRs are on the staging_done branch. A mentor will prepare the staging_done |
110 | | A mentor will create a branch with your name or nick in that GCI repository to receive your pull requests. You can get a |
111 | | copy of this branch by doing this (replace abcde with your branch name): |
| 98 | We are going to collect up student work for several days, and then test it and submit it all together to the main repository. |
| 99 | Because of that, we won't update from the main repository during that time. This will fix the problem students saw with having |
| 100 | extra commits from the main repository that were not in the GCI repository appear in their pull requests. |
| 101 | |
| 102 | We are going to use a branch called "staging" to hold students' work, so when you are ready to start working on code, you can |
| 103 | pull a copy of this branch to your local repository. This is where you will send pull requests. To get a copy of this branch: |
| 104 | |
116 | | Every few days, we switch to updated branches, and submit a combined PR, with all student work for those days, to the main |
117 | | repository. (Even with this extra step, your commits will have your name on them, and will show up in the main repository.) |
118 | | The mentor reviewing or approving your task should tell you went to switch, but you can ask, to be sure. The mentor will |
119 | | update your branch in the GCI repository. You can rename the branch you were using locally for GCI work, just to be safe: |
| 109 | You can call your local branch whatever you want. One suggestion is to pull a fresh copy of the staging branch when you are about |
| 110 | to start a new task. (You can keep any old branch you were working on for previous tasks, or delete it after your pull request for |
| 111 | the previous task is accepted and merged into the staging branch. But it is better not to reuse that branch to avoid unexpected |
| 112 | merge issues with new work. If you want to use the same branch name, then you can rename your old branch.) |
| 113 | |
| 114 | Note, your commits will still have your name on them as author when they get into the main repository! |
| 115 | |
| 116 | The steps to submit your work are similar to those in the git wiki page linked above -- differences are noted here. |
| 117 | * "Squash" your commits into one. |
| 118 | * ''This is different:'' Don't rebase from the main repository -- instead, rebase *from the staging branch* -- the same branch you will send the pull request to. |