refactor: we're breaking out merge-conflicts

This commit is contained in:
Bjarke Sporring
2026-01-15 12:51:43 +01:00
parent ea5cbccc75
commit 7b638d27de
29 changed files with 1385 additions and 1310 deletions

View File

@@ -1,254 +0,0 @@
# Facilitator Setup Guide
This guide helps workshop facilitators set up the cloud-based multiplayer Git module using Azure DevOps.
## Overview
The Number Challenge is a collaborative Git exercise where students work together on a shared repository hosted on **Azure DevOps**.
**What participants will do:**
- Clone a real repository from Azure DevOps
- Collaborate to sort numbers 0-20 into the correct order
- Experience push/pull workflow and merge conflicts
- Learn to communicate and coordinate with teammates
- Use SSH keys for secure authentication
---
## Prerequisites
### Azure DevOps Setup
You need:
- **Azure DevOps Organization** - Free tier is sufficient
- Sign up at [dev.azure.com](https://dev.azure.com)
- **Project created** within your organization
- **Admin access** to create repositories and manage users
### Workshop Materials
Participants need:
- Git installed (version 2.23+)
- VS Code (or any text editor)
- SSH keys configured
---
## Pre-Workshop Setup
### Step 1: Add User Accounts
Add workshop participants to your Azure DevOps organization.
1. Navigate to **Organization Settings****Users**
2. Click **Add users**
3. Enter participant email addresses (Microsoft accounts)
4. Select your workshop project
5. Select **Access level**: Stakeholder (free) or Basic
6. Click **Add**
### Step 2: Create the Repository
Create the shared repository: **number-challenge**
1. Sign in to Azure DevOps at [dev.azure.com](https://dev.azure.com)
2. Navigate to your **Project**
3. Click **Repos** in the left navigation
4. Click the repo dropdown → **New repository**
5. Fill in details:
- **Name:** `number-challenge`
- **Add a README:** Checked
6. Click **Create**
### Step 3: Add the Starter File
Create `numbers.txt` with numbers 0-20 in random order.
**Option A: Via Azure DevOps web UI**
1. In your repository, click **+ New** → **File**
2. Name it `numbers.txt`
3. Add this content (numbers 0-20 shuffled):
```
17
3
12
8
19
1
14
6
11
0
20
9
4
16
2
18
7
13
5
15
10
```
4. Click **Commit**
**Option B: Via command line**
```powershell
git clone git@ssh.dev.azure.com:v3/{organization}/{project}/number-challenge
cd number-challenge
# Create numbers.txt with shuffled numbers
@"
17
3
12
8
19
1
14
6
11
0
20
9
4
16
2
18
7
13
5
15
10
"@ | Out-File -FilePath numbers.txt -Encoding UTF8
git add numbers.txt
git commit -m "feat: add shuffled numbers for challenge"
git push
```
### Step 4: Verify Student Access
Students added to the project automatically have access. Verify:
1. Go to **Project Settings****Repositories****number-challenge**
2. Click **Security** tab
3. Verify project team has **Contribute** permission
---
## During the Workshop
### Getting Started
1. Ensure all students have cloned the repository
2. Have everyone open `numbers.txt` to see the shuffled numbers
3. Explain the goal: sort numbers 0-20 into correct order
### The Exercise Flow
1. **Students pull** the latest changes
2. **One person** moves a number to its correct position
3. **They commit and push**
4. **Others pull** and see the change
5. **Repeat** until sorted
### Creating Conflicts (The Learning Moment)
Conflicts happen naturally when multiple people edit at once. You can encourage this:
- Have two students deliberately edit at the same time
- Watch them experience the push rejection
- Guide them through pulling and resolving the conflict
### Monitoring Progress
Check progress in Azure DevOps:
- **Repos → Commits**: See who's contributing
- **Repos → Files → numbers.txt**: See current state
### Common Issues
**"I can't push!"**
- Did they pull first? Run `git pull`
- Is SSH set up? Check with `ssh -T git@ssh.dev.azure.com`
**"Merge conflict!"**
- Walk them through removing conflict markers
- Help them understand both sides of the conflict
**"Numbers are duplicated/missing!"**
- Someone resolved a conflict incorrectly
- Have the team review and fix together
---
## Success
When complete, `numbers.txt` should contain:
```
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
```
Celebrate the team's success!
---
## Post-Workshop Cleanup
To reuse the repository:
1. Reset `numbers.txt` to shuffled state
2. Or delete and recreate the repository
---
## Tips
- **Keep groups small** (4-8 people) for more interaction
- **Encourage communication** - the exercise works best when people talk
- **Let conflicts happen** - they're the best learning opportunity
- **Walk the room** - help students who get stuck
- **Point students to 03_TASKS.md** - Simple explanations of clone, push, pull, and fetch for beginners
---
## Troubleshooting
### SSH Issues
- Verify SSH key added to Azure DevOps (User Settings → SSH Public Keys)
- Test: `ssh -T git@ssh.dev.azure.com`
### Permission Issues
- Check user is added to project
- Verify Contribute permission on repository
### Service Issues
- Check status: https://status.dev.azure.com

File diff suppressed because it is too large Load Diff

View File

@@ -1,395 +0,0 @@
# Multiplayer Git Tasks
These tasks walk you through collaborating with Git in the cloud. You'll clone a shared repository, make changes, and sync with your teammates.
## Prerequisites
Before starting, make sure you have:
- [ ] An account on the team's Azure DevOps project
- [ ] SSH key configured (ask your facilitator if you need help)
- [ ] Git installed on your computer
---
## Task 1: Clone the Repository
Cloning creates a local copy of a remote repository on your computer.
### Steps
1. Get the SSH URL from Azure DevOps:
- Navigate to the repository
- Click **Clone**
- Select **SSH**
- Copy the URL
2. Open PowerShell and run:
```powershell
git clone <paste-the-url-here>
```
3. Open the folder in VS Code:
```powershell
code <repository-name>
```
4. Open the VS Code terminal (`` Ctrl+` ``) and verify the clone worked:
```powershell
git status
git log --oneline --graph --all
```
### What Just Happened?
```
Azure DevOps Your Computer
┌─────────────┐ ┌─────────────┐
│ Repository │ ───── clone ──> │ Repository │
│ (original) │ │ (copy) │
└─────────────┘ └─────────────┘
```
You now have:
- A complete copy of all files
- The entire commit history
- A connection back to the original (called "origin")
---
## Task 2: Make Changes and Push
Pushing sends your local commits to the remote repository.
### Steps
1. In VS Code, create a new file:
- Click **File → New File** (or `Ctrl+N`)
- Add some content, for example: `Hello from <your-name>`
- Save as `hello-<your-name>.txt` (use `Ctrl+S`)
2. In the VS Code terminal, stage and commit your change:
```powershell
git add .
git commit -m "feat: add greeting from <your-name>"
```
3. Push to the remote:
```powershell
git push
```
### What Just Happened?
```
Your Computer Azure DevOps
┌─────────────┐ ┌─────────────┐
│ Commit A │ │ Commit A │
│ Commit B │ ───── push ───> │ Commit B │
│ Commit C │ (new!) │ Commit C │
└─────────────┘ └─────────────┘
```
Your new commit is now on the server. Others can see it and download it.
---
## Task 3: Pull Changes from Others
Pulling downloads new commits from the remote and merges them into your branch.
### Steps
1. Check if there are new changes:
```powershell
git status
```
Look for "Your branch is behind..."
2. Pull the changes:
```powershell
git pull
```
3. See what's new:
```powershell
git log --oneline -10
```
### What Just Happened?
```
Azure DevOps Your Computer
┌─────────────┐ ┌─────────────┐
│ Commit A │ │ Commit A │
│ Commit B │ │ Commit B │
│ Commit C │ ───── pull ───> │ Commit C │
│ Commit D │ (new!) │ Commit D │
└─────────────┘ └─────────────┘
```
Your local repository now has all the commits from the remote.
---
## Task 4: The Push-Pull Dance
When working with others, you'll often need to pull before you can push.
### The Scenario
You made a commit, but someone else pushed while you were working:
```
Azure DevOps: A ── B ── C ── D (teammate's commit)
Your Computer: A ── B ── C ── E (your commit)
```
### Steps
1. Try to push:
```powershell
git push
```
This will fail with: "Updates were rejected because the remote contains work that you do not have locally"
2. Pull first:
```powershell
git pull
```
3. Now push:
```powershell
git push
```
### What Happened?
```
Before pull:
Remote: A ── B ── C ── D
Local: A ── B ── C ── E
After pull (Git merges automatically):
Local: A ── B ── C ── D ── M
\ /
E ───┘
After push:
Remote: A ── B ── C ── D ── M
\ /
E ───┘
```
---
## Task 5: Understanding Fetch
Fetch downloads changes but does **not** merge them. This lets you see what's new before deciding what to do.
### Steps
1. Fetch updates from the remote:
```powershell
git fetch
```
2. See what's different:
```powershell
git log HEAD..origin/main --oneline
```
This shows commits on the remote that you don't have locally.
3. When ready, merge:
```powershell
git merge origin/main
```
### Fetch vs Pull
| Command | Downloads | Merges | Safe to run anytime? |
|---------|-----------|--------|----------------------|
| `git fetch` | Yes | No | Yes |
| `git pull` | Yes | Yes | Usually |
**Think of it this way:**
- `fetch` = "Show me what's new"
- `pull` = "Give me what's new" (same as `fetch` + `merge`)
---
## Task 6: Working with Branches
Branches let you work on features without affecting the main code.
### Steps
1. Create and switch to a new branch:
```powershell
git switch -c feature/<your-name>-greeting
```
2. In VS Code, create a new file:
- Click **File → New File** (or `Ctrl+N`)
- Add some content, for example: `A special greeting`
- Save as `special.txt` (use `Ctrl+S`)
3. Stage and commit:
```powershell
git add .
git commit -m "feat: add special greeting"
```
4. Push your branch to the remote:
```powershell
git push -u origin feature/<your-name>-greeting
```
The `-u` flag sets up tracking so future pushes are simpler.
5. Go back to main:
```powershell
git switch main
```
---
## Task 7: The Number Challenge
This is the main collaborative exercise. Your team will work together to sort numbers 0-20 into the correct order.
### The Setup
The repository contains a file called `numbers.txt` with numbers 0-20 in random order:
```
17
3
12
8
...
```
Your goal: Work as a team to rearrange the numbers so they appear in order from 0 to 20.
### The Rules
1. **Each person moves ONE number per commit**
2. **You must pull before making changes**
3. **Communicate with your team** - decide who moves which number
### Steps
1. Pull the latest changes:
```powershell
git pull
```
2. Open `numbers.txt` in VS Code
3. Find a number that's out of place and move it to the correct position
- For example, if `5` is at the bottom, move it between `4` and `6`
4. Save the file (`Ctrl+S`)
5. Commit your change with a clear message:
```powershell
git add numbers.txt
git commit -m "fix: move 5 to correct position"
```
6. Push your change:
```powershell
git push
```
7. If push fails (someone else pushed first):
```powershell
git pull
```
Resolve any conflicts, then push again.
8. Repeat until all numbers are in order!
### Handling Conflicts
When two people edit the same part of the file, you'll see conflict markers:
```
<<<<<<< HEAD
4
5
6
=======
4
6
>>>>>>> origin/main
```
To resolve:
1. Decide what the correct order should be
2. Remove the conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`)
3. Keep only the correct content:
```
4
5
6
```
4. Save, commit, and push
### Success
When complete, `numbers.txt` should look like:
```
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
```
Celebrate with your team!
---
## Quick Reference
| Command | What It Does |
|---------|--------------|
| `git clone <url>` | Download a repository |
| `git push` | Upload your commits |
| `git pull` | Download and merge commits |
| `git fetch` | Download commits (don't merge) |
| `git switch -c <name>` | Create and switch to a branch |
| `git push -u origin <branch>` | Push a new branch |
---
## Common Issues
### "Permission denied (publickey)"
Your SSH key isn't set up correctly. See the SSH setup guide or ask your facilitator.
### "Updates were rejected"
Someone pushed before you. Run `git pull` first, then `git push`.
### "Merge conflict"
Two people edited the same lines. See BEST-PRACTICES.md for how to handle this.
### "There is no tracking information"
Run `git push -u origin <branch-name>` to set up tracking.