ME204 2026 Icon

๐Ÿ’ป Week 02, Day 03 - Lab

Working on a Shared Repository

Author

Dr Jon Cardoso-Silva

Last updated

22 July 2026

๐Ÿฅ… Learning Objectives

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 I: Shared repo setup

Your class teacher will help groups form and check that invites went through before you clone.

๐ŸŽฏ Action points

  1. Form a pair or trio with people near you.
  2. One person creates a new repository on GitHub (README on, Python .gitignore). Suggested name: me204-collab-practice (or anything your group likes).
  3. That person opens Settings โ†’ Collaborators (private repos) or Settings โ†’ Collaborators and teams, then Add people, and invites the others by GitHub username.
  4. Invitees accept the email or the GitHub notification (bell icon).
  5. Everyone copies the SSH clone URL from the green Code button.

Part II: Parallel edits (different files)

๐ŸŽฏ Action points

  1. Everyone clones into their Nuvolos workspace and cd into the folder.
  2. 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.md with two short lines
    • Person C (if any) creates notes-c.md with two short lines
  3. Each person runs git add, git commit, and git push for their own file only.
  4. Everyone runs git pull and 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.

Important

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 pull

In 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 Society

Then commit and push:

git add README.md
git commit -m "Rename project to Pizza Appreciation Society"
git push

Confirm 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 Club

Commit and try to push:

git add README.md
git commit -m "Rename project to Taco Fan Club"
git push

The push will be rejected. That is expected.

Resolve the conflict

Person B pulls so Git can merge:

git pull

Open README.md. You will see something like:

<<<<<<< HEAD
# ๐ŸŒฎ Taco Fan Club
=======
# ๐Ÿ• Pizza Appreciation Society
>>>>>>> origin/main

VS 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 push

Everyone else (including Person C) pulls:

git pull
How 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

  1. One person: git switch -c tweak-readme, change one line in the README, commit, git push -u origin tweak-readme.
  2. On GitHub, open Compare & pull request (or Pull requests โ†’ New).
  3. Another teammate reads the diff and merges (or you merge after a quick look).
  4. Everyone: git switch main and git pull.

If the room is still finishing conflicts, your class teacher may demo this once at the front instead.

Before you leave