You can follow the steps in the simulation of a forking workflow given below to learn how to follow such a workflow.
This activity is best done as a team.
Step 1. One member: set up the team org and the team repo.
-
Create a GitHub organization for your team. The org name is up to you. We'll refer to this organization as team org from now on.
-
Add a team called developers
to your team org.
-
Add team members to the developers
team.
-
Fork se-edu/samplerepo-workflow-practice to your team org. We'll refer to this as the team repo.
-
Add the forked repo to the developers
team. Give write access.
Step 2. Each team member: create PRs via own fork.
-
Fork that repo from your team org to your own GitHub account.
-
Create a branch named add-{your name}-info
(e.g. add-johnTan-info
) in the local repo.
-
Add a file yourName.md
into the members
directory (e.g., members/jonhTan.md
) containing some info about you into that branch.
-
Push that branch to your fork.
-
Create a PR from that branch to the master
branch of the team repo.
Step 3. For each PR: review, update, and merge.
-
[A team member (not the PR author)] Review the PR by adding comments (can be just dummy comments).
-
[PR author] Update the PR by pushing more commits to it, to simulate updating the PR based on review comments.
-
[Another team member] Approve and merge the PR using the GitHub interface.
-
[All members] Sync your local repo (and your fork) with upstream repo. In this case, your upstream repo is the repo in your team org.
Step 4. Create conflicting PRs.
-
[One member]: Update README: In the master
branch, remove John Doe and Jane Doe from the README.md
, commit, and push to the main repo.
-
[Each team member] Create a PR to add yourself under the Team Members
section in the README.md
. Use a new branch for the PR e.g., add-johnTan-name
.
Step 5. Merge conflicting PRs one at a time. Before merging a PR, you’ll have to resolve conflicts.
-
[Optional] A member can inform the PR author (by posting a comment) that there is a conflict in the PR.
-
[PR author] Resolve the conflict locally:
- Pull the
master
branch from the repo in your team org.
- Merge the pulled
master
branch to your PR branch.
- Resolve the merge conflict that crops up during the merge.
- Push the updated PR branch to your fork.
-
[Another member or the PR author]: Merge the de-conflicted PR: When GitHub does not indicate a conflict anymore, you can go ahead and merge the PR.