๐ป Week 02, Day 03 - Lab
Working on a Shared Repository
By the end of this lab, you should be able to: i) Form a pair or trio and share one GitHub repository (one person creates, others join as collaborators), ii) Clone the shared repo on Nuvolos and make parallel commits from more than one machine, iii) Recognise and resolve a merge conflict when two people edit the same lines, iv) (If time) Open a Pull Request to review a branch before it merges into main.
โฐ Wednesday, 22 July 2026 | Check your timetable for your class time ๐ Check your timetable for the location of your class
This morning you published a tiny site from your own repo. This afternoon you practice the hard part: more than one person on the same repository.
You will work in pairs or trios. One person creates the repo and invites the others. Then we arrange a conflict on purpose so you see the markers and learn to resolve them. If time remains, we look at Pull Requests.
๐ฃ๏ธ Lab Roadmap
| Part | Time | What you do |
|---|---|---|
| Part I | ~15 min | Form pairs/trios, one person creates the repo, invite collaborators |
| Part II | ~20 min | Everyone clones, each person edits a different file and pushes |
| Part III | ~25 min | Forced conflict on a shared file, resolve, push the fix |
| Part IV | Remaining | (Optional) Pull Request walkthrough |
Part II: Parallel edits (different files)
๐ฏ Action points
- Everyone clones into their Nuvolos workspace and
cdinto the folder. - Agree who owns which file so the first pushes do not collide:
- Person A edits the top of
README.md(add one bullet under a Team heading) - Person B creates
notes-b.mdwith two short lines - Person C (if any) creates
notes-c.mdwith two short lines
- Person A edits the top of
- Each person runs
git add,git commit, andgit pushfor their own file only. - Everyone runs
git pulland confirms the othersโ files appear.
Part III: Force a conflict
Merge conflicts happen when two people edit the same line. They are a normal part of collaboration, not an error. This exercise creates one on purpose so you know what to expect.
Do not skip ahead. Wait for your class teacherโs signal so both of you edit the same line before anyone pulls.
Setup (everyone)
Start from a clean, up-to-date main:
git switch main
git pullIn a trio, pick two people for this part (Person A and Person B). The third person watches, then pulls when the conflict is resolved.
Person A
On your class teacherโs cue, open README.md and replace the first line (the # title) with:
# ๐ Pizza Appreciation SocietyThen commit and push:
git add README.md
git commit -m "Rename project to Pizza Appreciation Society"
git pushConfirm the new title on github.com before Person B continues.
Person B (do not pull yet)
Open the same README.md and replace the same first line with:
# ๐ฎ Taco Fan ClubCommit and try to push:
git add README.md
git commit -m "Rename project to Taco Fan Club"
git pushThe push will be rejected. That is expected.
Resolve the conflict
Person B pulls so Git can merge:
git pullOpen README.md. You will see something like:
<<<<<<< HEAD
# ๐ฎ Taco Fan Club
=======
# ๐ Pizza Appreciation Society
>>>>>>> origin/mainVS Code shows these markers in colour. Choose the title your group wants (or write a third one you both like). Delete every <<<<<<<, =======, and >>>>>>> line, then save.
git add README.md
git commit -m "Resolve conflict: agreed on project name"
git pushEveryone else (including Person C) pulls:
git pullHow to read the markers
Everything between <<<<<<< and ======= is your side (Person B, after the pull). Everything between ======= and >>>>>>> is what came from the remote (Person A). Keep one title, delete the markers, save, then stage and commit.
Part IV: Pull Requests (if time)
๐ฏ Action points
- One person:
git switch -c tweak-readme, change one line in the README, commit,git push -u origin tweak-readme. - On GitHub, open Compare & pull request (or Pull requests โ New).
- Another teammate reads the diff and merges (or you merge after a quick look).
- Everyone:
git switch mainandgit pull.
If the room is still finishing conflicts, your class teacher may demo this once at the front instead.