Files
git-workshop/01-essentials/09-multiplayer/02_README.md
2026-01-15 12:51:43 +01:00

34 KiB

Module 08: Multiplayer Git - The Number Challenge

Learning Objectives

By the end of this module, you will:

  • Clone and work with remote repositories on a cloud server
  • Collaborate with teammates using a shared repository
  • Experience push rejections when your local repository is out of sync
  • Resolve merge conflicts in a real team environment
  • Practice the fundamental push/pull workflow
  • Apply all the Git skills you've learned in a collaborative setting

Welcome to Real Collaboration!

Congratulations on making it this far! You've learned Git basics: committing, branching, merging, and even resolving conflicts solo. But here's where it gets real - working with actual teammates on a shared codebase.

This module is different from all the others. There's no setup.ps1 script creating a simulated environment. Instead, you'll work with:

  • A real Git server: Azure DevOps (your facilitator will provide the specific URL)
  • Real teammates
  • A shared repository where everyone works together
  • Real merge conflicts when multiple people edit the same file
  • Real push rejections when your local repository falls out of sync

This is exactly how professional developers collaborate every day on GitHub, GitLab, Bitbucket, Azure DevOps, and company Git servers.

New to remote Git commands? Check out GIT-BASICS.md for simple explanations of clone, push, pull, and fetch!

Ready? Let's collaborate!


The Number Challenge

What You'll Do

Your team will work together to sort a jumbled list of numbers (0-20) into the correct order. The repository contains a file called numbers.txt with numbers in random order:

17
3
12
8
19
...

Your goal: Work as a team to rearrange the numbers so they appear in order from 0 to 20:

0
1
2
3
4
...
20

The rules:

  • Each person moves ONE number per commit
  • You MUST pull before making changes to get the latest version
  • Communicate with your team - coordination is key!

The challenge: You'll experience merge conflicts when two people edit the file at the same time, and push rejections when your local copy is out of sync with the server.

Why This Exercise?

This exercise teaches collaboration in a safe, structured way:

  1. Simple task: Moving a number is easy. The hard part is Git, not the work itself.
  2. Clear success: You can instantly see when all numbers are sorted.
  3. Guaranteed conflicts: Multiple people editing the same file creates conflicts to practice resolving.
  4. Push rejections: You'll experience what happens when your database goes out of sync with the remote.
  5. Team coordination: Success requires communication and collaboration.
  6. Safe experimentation: It's okay to make mistakes - you can always pull a fresh copy!

Repository Structure

number-challenge/
├── numbers.txt       # The file everyone edits - contains numbers 0-20
└── README.md         # Quick reference for the challenge

Note: The repository is already set up on the server. You'll clone it and start collaborating!


Prerequisites

Before starting, ensure you have:

1. Your Azure DevOps Account

Your facilitator will provide:

  • Organization and Project URLs for the workshop
  • Azure DevOps account credentials (Microsoft Account or Azure AD)
  • SSH Key Setup (Recommended - see below)

First-time setup: Visit the Azure DevOps URL provided by your facilitator and sign in to verify your account works.

2. Git Configuration

Verify your Git identity is configured:

git config --global user.name
git config --global user.email

If these are empty, set them now:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Why this matters: Every commit you make will be tagged with this information.

SSH is the best practice for secure Git authentication. It provides secure, passwordless access to Azure DevOps without exposing credentials.

Quick SSH Setup

If you haven't set up SSH keys yet, follow these steps:

  1. Generate SSH key:

    ssh-keygen -t rsa -b 4096 -C "your.email@example.com"
    

    Press Enter to accept default location, optionally add a passphrase for extra security.

    Note: Azure DevOps requires RSA keys. See AZURE-DEVOPS-SSH-SETUP.md for details on why we use RSA.

  2. Copy your public key:

    Linux/Mac:

    cat ~/.ssh/id_rsa.pub
    

    Windows PowerShell:

    type $HOME\.ssh\id_rsa.pub
    
  3. Add to Azure DevOps:

    • Sign in to Azure DevOps
    • Click your profile icon (top-right) → User settings
    • Select SSH Public Keys
    • Click + New Key
    • Paste your public key and give it a name (e.g., "Workshop Laptop 2026")
    • Click Save

    Azure DevOps - SSH Public Keys Navigate to User Settings → SSH Public Keys to add your SSH key

  4. Test your SSH connection:

    ssh -T git@ssh.dev.azure.com
    

    Expected output: remote: Shell access is not supported. - This is normal and means authentication worked!

For detailed SSH setup instructions including troubleshooting, see: AZURE-DEVOPS-SSH-SETUP.md

Alternative: HTTPS with Personal Access Token (PAT)

If you cannot use SSH (firewall restrictions, etc.), you can use HTTPS with a Personal Access Token:

  1. Sign in to Azure DevOps
  2. Click your profile icon → Personal access tokens
  3. Click + New Token
  4. Give it a name, set expiration, and select Code (Read & Write) scope
  5. Click Create and copy the token (you won't see it again!)
  6. Use the token as your password when Git prompts for credentials

Note: SSH is recommended for security and convenience. With SSH, you won't need to enter credentials for every push/pull.


Part 1: Getting Started (15 minutes)

Step 1: Get Ready

Your facilitator will explain the exercise. Everyone on the team will work together on the same repository.

Important: Everyone will work on the same branch (main). This simulates real team development where multiple developers collaborate on a shared codebase.

Step 2: Understand the Exercise

Your team will collaborate to sort the numbers in numbers.txt from 0 to 20.

The approach:

  • Everyone works on the same file (numbers.txt)
  • Everyone works on the same branch (main)
  • Each person moves one number per commit
  • Communication is key to avoid too many conflicts!

Step 3: Clone the Repository

Your facilitator will provide the exact repository URL. The format depends on your authentication method:

Using SSH (Recommended):

# Replace {organization}, {project}, and {repository} with values from your facilitator
git clone git@ssh.dev.azure.com:v3/{organization}/{project}/number-challenge
cd number-challenge

Example:

git clone git@ssh.dev.azure.com:v3/workshoporg/git-workshop/number-challenge
cd number-challenge

Using HTTPS (with PAT):

# Replace {organization} and {project} with values from your facilitator
git clone https://dev.azure.com/{organization}/{project}/_git/number-challenge
cd number-challenge

Note: Use the exact URL provided by your facilitator to ensure you're cloning the correct repository.

Expected output:

Cloning into 'number-challenge'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 10 (delta 2), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (10/10), done.
Resolving deltas: 100% (2/2), done.

Success! You now have a local copy of the shared repository.

Step 4: Explore the Repository

Let's see what we're working with:

# List files
ls -la

# View the numbers file
cat numbers.txt

What you'll see in numbers.txt:

17
3
12
8
19
1
14
6
11
0
20
9
4
16
2
18
7
13
5
15
10

The numbers are all jumbled up! Your team's goal is to sort them from 0 to 20.

Step 5: Understanding the Workflow

For this exercise, everyone works on the main branch together.

Unlike typical Git workflows where you create feature branches, this exercise intentionally has everyone work on the same branch to experience:

  • Push rejections when someone else pushed before you
  • Merge conflicts when two people edit the same line
  • The pull-before-push cycle that's fundamental to Git collaboration

There's no need to create a branch - you'll work directly on main after cloning.


Part 2: Your First Contribution (20 minutes)

Now you'll practice the basic collaborative workflow: make a change, commit, push, and help others pull your changes.

Step 1: Decide Who Goes First

Pick someone to go first. They'll move one number to its correct position.

Step 2: First Person - Move ONE Number

First person: Open numbers.txt in your text editor.

Look at the file and find a number that's in the wrong position. Let's say you decide to move the 0 to the top.

Before:

17
3
12
8
19
1
14
6
11
0    ← Let's move this to the top!
20
...

After editing:

0    ← Moved to the top!
17
3
12
8
19
1
14
6
11
20
...

Key point: Move ONLY ONE number per commit. This keeps things simple and helps everyone track changes.

Step 3: Commit Your Change

git status
# You should see: modified: numbers.txt

git add numbers.txt
git commit -m "Move 0 to its correct position"

Expected output:

[main abc1234] Move 0 to its correct position
 1 file changed, 1 insertion(+), 1 deletion(-)

Step 4: Push to Remote

This uploads your commit to the shared server:

git push origin main

Expected output:

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 345 bytes | 345.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Analyzing objects... (100%) (3/3) (X ms)
remote: Storing packfile... done (X ms)
remote: Storing index... done (X ms)
To ssh.dev.azure.com:v3/{organization}/{project}/number-challenge
   abc1234..def5678  main -> main

Success! Your change is now on the server for everyone to see.

Step 5: Others - Pull the Change

Everyone else: Make sure you get the latest changes:

# Pull the changes from the server
git pull origin main

Expected output:

From ssh.dev.azure.com:v3/{organization}/{project}/number-challenge
 * branch            main -> FETCH_HEAD
Updating 123abc..456def
Fast-forward
 numbers.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Verify you have the update:

cat numbers.txt
# Should show 0 at the top

You now have the first person's change!

Step 6: Next Person's Turn

Next person: Now it's your turn! Pick a different number and move it to its correct position.

Follow the same cycle:

  1. Pull first: git pull origin main (always get the latest!)
  2. Edit numbers.txt - move ONE number
  3. Commit: git add numbers.txt && git commit -m "Move X to correct position"
  4. Push: git push origin main
  5. Tell the team you pushed!

Step 7: Keep Taking Turns

Continue this pattern:

  • Always pull before editing
  • Move one number per person
  • Commit with a clear message
  • Push to share with the team
  • Communicate when you've pushed

As you work, the file gradually becomes more sorted:

After a few rounds:
0
1
2
3
17    ← Still needs to be moved
12    ← Still needs to be moved
...

Congratulations! You've completed your first collaborative Git workflow! You've learned the core cycle: pull → work → commit → push. This is what professional developers do hundreds of times per day.


Part 3: Deliberate Conflict Exercise (30 minutes)

Now for the real learning: merge conflicts! You'll deliberately create a conflict, then resolve it together.

The Scenario

Merge conflicts happen when two people edit the same lines in the same file. Git can't automatically decide which version to keep, so it asks you to resolve it manually.

What you'll do:

  1. Two people will BOTH edit the same line in numbers.txt
  2. Person A pushes first (succeeds)
  3. Person B tries to push (gets rejected!)
  4. Person B pulls (sees conflict markers)
  5. You resolve the conflict together
  6. Person B pushes the resolution

This is a deliberate practice scenario. In real projects, conflicts happen by accident - now you'll know how to handle them!

Setup: Choose Two People

Pick two people to create the conflict. Let's call them Person A and Person B.

Everyone else can watch and learn - you'll create your own conflicts later!

Step 1: Both People Start Fresh

Make sure you both have the latest code:

git pull origin main

# Check status - should be clean
git status

Both people should see: "Your branch is up to date with 'origin/main'" and "nothing to commit, working tree clean"

Step 2: Person A - Make Your Change First

Person A: Open numbers.txt and move a specific number. Let's say you decide to move 17 down a few lines.

Before:

17   ← Let's move this
3
12
8

After (Person A's version):

3
17   ← Moved here
12
8

Commit and push IMMEDIATELY:

git add numbers.txt
git commit -m "Person A: Move 17 down"
git push origin main

Person A should see the push succeed.

Step 3: Person B - Make DIFFERENT Change (DON'T PULL YET!)

Person B: This is critical - do NOT pull Person A's changes yet!

Instead, edit the SAME lines with a DIFFERENT change. Move 17 to a different position:

Before:

17   ← Let's move this somewhere else
3
12
8

After (Person B's version):

3
12
17   ← Moved to a different position than Person A!
8

Commit (but don't push yet):

git add numbers.txt
git commit -m "Person B: Move 17 down"

Step 4: Person B - Try to Push (This Will Fail!)

git push origin main

You'll see an error like this:

To ssh.dev.azure.com:v3/{organization}/{project}/number-challenge
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'git@ssh.dev.azure.com:v3/{organization}/{project}/number-challenge'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Don't panic! This is completely normal and expected. Git is protecting you from overwriting Person A's work.

What happened: Person A pushed commits that you don't have. Git requires you to pull first and integrate their changes before you can push yours.

Step 5: Person B - Pull and See the Conflict

git pull origin main

You'll see:

From ssh.dev.azure.com:v3/{organization}/{project}/number-challenge
 * branch            main -> FETCH_HEAD
Auto-merging numbers.txt
CONFLICT (content): Merge conflict in numbers.txt
Automatic merge failed; fix conflicts and then commit the result.

This is a merge conflict! Git tried to merge Person A's changes with yours, but couldn't automatically combine them because you both edited the same lines.

Step 6: Check Git Status

git status

Output:

On branch main
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   numbers.txt

no changes added to commit (use "git add" and/or "git commit -a")

Git is telling you: "The file numbers.txt has conflicts. Both of you modified it. Please resolve and commit."

Step 7: Open the Conflicted File

cat numbers.txt
# Or open in your text editor: code numbers.txt, vim numbers.txt, nano numbers.txt

Find the conflict markers:

3
<<<<<<< HEAD
12
17
=======
17
12
>>>>>>> abc1234567890abcdef1234567890abcdef12
8

Understanding Conflict Markers

<<<<<<< HEAD                        # Start marker
12                                  # YOUR version (Person B's order)
17
=======                             # Divider
17                                  # THEIR version (Person A's order from remote)
12
>>>>>>> abc1234...                  # End marker (shows commit hash)

The three sections:

  1. <<<<<<< HEAD to =======: Your current changes (what you committed locally)
  2. ======= to >>>>>>>: Their changes (what Person A pushed to the server)
  3. You must choose one, combine them, or write something new

Step 8: Resolve the Conflict TOGETHER

Talk with the group! Look at both versions and decide which order makes sense.

Person A's version:

3
17
12
8

Person B's version:

3
12
17
8

Decide together: Which is closer to the correct sorted order (0-20)? Or is there a better way?

Edit the file to:

  1. Remove ALL conflict markers (<<<<<<<, =======, >>>>>>>)
  2. Keep the agreed-upon order
  3. Make sure the file is clean

Example resolved version:

3
12
17
8

Save the file!

Step 9: Verify the Resolution

cat numbers.txt

Make sure you don't see any conflict markers (<<<<<<<, =======, >>>>>>>). The file should just contain numbers.

Step 10: Mark as Resolved and Commit

Tell Git you've resolved the conflict:

git add numbers.txt

This stages the resolved file.

Now commit the resolution:

git commit -m "Resolve conflict - agreed on number order"

Note: Git may open an editor with a default merge commit message. You can keep it or customize it.

Expected output:

[main def5678] Resolve conflict - agreed on number order

Step 11: Person B - Push the Resolution

git push origin main

This time it should succeed! The conflict is resolved and the agreed-upon order is on the server.

Step 12: Everyone - Pull the Resolved Version

Everyone else: Get the resolved version:

git pull origin main

Check the file - you should see the agreed-upon resolution.

You've successfully resolved your first merge conflict together! In real projects, this is a daily occurrence. You now know exactly what to do when you see those conflict markers.


Part 4: Continue Sorting (Until Complete)

Now that you understand the pull-push cycle and how to resolve conflicts, continue working as a team to sort all the numbers!

The Goal

Keep working until numbers.txt contains all numbers sorted from 0 to 20:

0
1
2
3
4
5
...
18
19
20

The Workflow

Continue the pattern you've learned:

  1. Pull first: Always start with git pull origin main
  2. Check the file: Look at numbers.txt to see what still needs sorting
  3. Move one number: Edit the file to move ONE number closer to its correct position
  4. Commit: git add numbers.txt && git commit -m "Move X to position Y"
  5. Push: git push origin main
  6. Communicate: Tell the team you've pushed so they can pull
  7. Repeat!

Tips for Success

Coordinate with your team:

  • Decide who goes next to avoid too many conflicts
  • Call out what number you're working on
  • Pull frequently to stay in sync

Handle conflicts calmly:

  • If you get a push rejection, don't panic - just pull first
  • If you get a merge conflict, work through it together
  • Remember: conflicts are normal and you know how to resolve them!

Check your progress:

  • View the file regularly: cat numbers.txt
  • Count how many numbers are in the right position
  • Celebrate as the file gets more sorted!

When You're Done

When all numbers are sorted correctly, verify your success:

git pull origin main
cat numbers.txt

Expected final result:

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Congratulations! Your team successfully collaborated using Git to complete the challenge!


Part 5: What You've Learned

You've now experienced the fundamental Git collaboration workflow that professional developers use every day!


Commands Reference

Essential Git Commands for Collaboration

Cloning and Setup:

git clone <url>                          # Create local copy of remote repo
git config user.name "Your Name"         # Set your name (one-time setup)
git config user.email "your@email.com"   # Set your email (one-time setup)

Branching:

git switch -c <branch-name>              # Create and switch to new branch
git switch <branch-name>                 # Switch to existing branch
git branch                               # List local branches (* = current)
git branch -a                            # List all branches (local + remote)
git branch -d <branch-name>              # Delete branch (safe - prevents data loss)

Making Changes:

git status                               # See current state and changed files
git add <file>                           # Stage specific file
git add .                                # Stage all changed files
git commit -m "message"                  # Commit staged changes with message
git commit                               # Commit and open editor for message

Synchronizing with Remote:

git pull origin <branch>                 # Fetch and merge from remote branch
git push origin <branch>                 # Push commits to remote branch
git push -u origin <branch>              # Push and set upstream tracking
git fetch origin                         # Download changes without merging
git remote -v                            # Show configured remotes

Conflict Resolution:

git status                               # See which files have conflicts
# Edit files to remove <<<<<<, =======, >>>>>>> markers
git add <resolved-file>                  # Mark file as resolved
git commit -m "Resolve conflict in ..."  # Commit the resolution
git merge --abort                        # Abort merge and go back to before

Merging and Integration:

git merge <branch-name>                  # Merge branch into current branch
git merge main                           # Common: merge main into feature branch
git log --oneline --graph --all          # Visualize branch history

Viewing Changes:

git diff                                 # See unstaged changes
git diff --staged                        # See staged changes
git show                                 # Show last commit
git log --oneline                        # See commit history (concise)
git log --oneline --graph                # See branch structure visually

Common Scenarios & Solutions

"My push was rejected!"

Error:

! [rejected] main -> main (fetch first)
error: failed to push some refs to 'git@ssh.dev.azure.com:v3/{organization}/{project}/number-challenge'

What it means: Someone else pushed commits to the branch since you last pulled.

Solution:

# Pull their changes first
git pull origin main

# If conflicts, resolve them (see Part 3)
# If no conflicts, you can now push
git push origin main

"I have merge conflicts!"

What you see:

CONFLICT (content): Merge conflict in numbers.txt
Automatic merge failed; fix conflicts and then commit the result.

Solution:

  1. Don't panic - this is normal!
  2. Run git status to see which files have conflicts
  3. Open numbers.txt in your editor
  4. Find the conflict markers: <<<<<<<, =======, >>>>>>>
  5. Talk with your team - decide which version makes sense
  6. Remove ALL markers and keep the agreed order
  7. Verify: cat numbers.txt (make sure no markers remain!)
  8. Stage: git add numbers.txt
  9. Commit: git commit -m "Resolve conflict in numbers.txt"
  10. Push: git push origin main

"Someone else pushed, how do I get their changes?"

Solution:

# Pull the latest changes
git pull origin main

If you have uncommitted changes, Git might ask you to commit or stash first:

# Option 1: Commit your changes first
git add numbers.txt
git commit -m "Move number X"
git pull origin main

# Option 2: Stash your changes temporarily
git stash
git pull origin main
git stash pop  # Restore your changes after pull

"Two people edited the same numbers!"

This creates a conflict - which is exactly what we want to practice!

Solution: Follow the complete conflict resolution workflow from Part 3. The key steps:

  1. Person who tries to push second gets rejection
  2. They pull (sees conflict)
  3. Everyone looks at the conflict markers together
  4. Decide which version to keep (or create new version)
  5. Remove markers, verify the file, commit, push

"How do I see what changed?"

Before committing:

git diff                    # See unstaged changes
git diff --staged           # See staged changes (after git add)

After committing:

git show                    # Show last commit's changes
git log --oneline           # See commit history (one line per commit)
git log --oneline --graph   # See branch structure with commits

"I want to start over on this file!"

Scenario: You made a mess and want to restore the file to the last committed version.

Solution:

# Discard all changes to the file (CAREFUL: can't undo this!)
git restore numbers.txt

# Or restore to a specific commit
git restore --source=abc1234 numbers.txt

If you want to keep your changes but try a different approach:

# Save your work temporarily
git stash

# Work is saved, file is back to clean state
# Later, restore your work:
git stash pop

"I accidentally deleted all the numbers!"

Don't worry - Git has your back!

Solution:

# If you haven't committed the deletion:
git restore numbers.txt

# If you already committed the deletion but haven't pushed:
git log --oneline  # Find the commit before deletion
git reset --hard abc1234  # Replace abc1234 with the good commit hash

# If you already pushed:
# Ask your facilitator for help, or let someone else pull and fix it!

Troubleshooting

Authentication Issues

Problem: "Authentication failed" or "Permission denied" when pushing or pulling

Solution (SSH - Recommended):

  1. Verify your SSH key is added to Azure DevOps:

    • Sign in to Azure DevOps
    • User Settings (profile icon) → SSH Public Keys
    • Confirm your key is listed
  2. Test SSH connection:

    ssh -T git@ssh.dev.azure.com
    

    Expected: remote: Shell access is not supported. (This is normal!)

    If you get "Permission denied (publickey)":

  3. Check your remote URL uses SSH:

    git remote -v
    

    Should show: git@ssh.dev.azure.com:v3/... (not https://)

    If it shows HTTPS, switch to SSH:

    git remote set-url origin git@ssh.dev.azure.com:v3/{organization}/{project}/number-challenge
    

Solution (HTTPS with PAT):

  1. Verify you're using a Personal Access Token (not your account password)

    • Azure DevOps → User Settings → Personal access tokens
    • Create new token with Code (Read & Write) scope
    • Use token as password when Git prompts for credentials
  2. Check token permissions:

    • Token must have Code (Read & Write) scope
    • Verify token hasn't expired
  3. Update stored credentials (if cached incorrectly):

    Windows:

    git credential-manager erase https://dev.azure.com
    

    Mac:

    git credential-osxkeychain erase https://dev.azure.com
    

    Linux:

    git config --global --unset credential.helper
    

Recommendation: Use SSH to avoid credential management issues. See AZURE-DEVOPS-SSH-SETUP.md.


Can't Pull or Push - "Unrelated Histories"

Problem:

fatal: refusing to merge unrelated histories

What happened: Your local branch and remote branch don't share a common ancestor (rare, but happens if branches were created independently).

Solution:

git pull origin main --allow-unrelated-histories

Then resolve any conflicts if they appear.


Accidentally Deleted Numbers

Problem: "I deleted numbers and committed it!"

Solution:

If not pushed yet:

# Find the commit before deletion
git log --oneline

# Example: abc1234 was the last good commit
git reset --hard abc1234

If already pushed:

# Find the commit with the correct numbers
git log --oneline

# Restore the file from that commit
git checkout abc1234 -- numbers.txt

# Commit the restoration
git add numbers.txt
git commit -m "Restore accidentally deleted numbers"
git push origin main

Pro tip: Use git log --all --full-history -- numbers.txt to see all commits that touched that file.


File Still Has Conflict Markers

Problem: You thought you resolved the conflict, but when you look at the file:

3
<<<<<<< HEAD
12
17
=======
17
12
>>>>>>> abc1234
8

What happened: You forgot to remove the conflict markers (<<<<<<<, =======, >>>>>>>).

Solution:

# Open the file
nano numbers.txt  # or vim, code, etc.

# Search for "<<<<<<<" and remove ALL markers
# Keep only the numbers you want

# Verify it's clean
cat numbers.txt

# If it looks good, commit the fix
git add numbers.txt
git commit -m "Remove remaining conflict markers"

Success Criteria

You've completed this module when you can check off ALL of these:

Basic Collaboration:

  • Cloned the repository from Azure DevOps using SSH
  • Successfully pushed at least one commit to the shared repository
  • Successfully pulled changes from other team members
  • Contributed to sorting the numbers file

Conflict Resolution:

  • Experienced or witnessed a merge conflict
  • Saw the conflict markers in the file (<<<<<<<, =======, >>>>>>>)
  • Resolved a conflict (or helped someone resolve one)
  • Successfully pushed the resolution

Push/Pull Cycle:

  • Experienced a push rejection when someone else pushed first
  • Understood why the push was rejected
  • Pulled changes before pushing again
  • Successfully pushed after pulling

Final Result:

  • The numbers.txt file contains all numbers from 0 to 20 in sorted order
  • No conflict markers remain in the file
  • Everyone on the team contributed at least one commit

Bonus (if time permits):

  • Helped someone else resolve a conflict
  • Created multiple merge conflicts and resolved them
  • Experimented with git stash when needing to pull with local changes

What You've Learned

Collaborative Git Skills:

  • Cloning repositories from remote Git servers
  • Working with teammates on a shared repository
  • The push/pull cycle for synchronizing work
  • Experiencing and resolving real merge conflicts
  • Understanding push rejections and why they happen
  • Communicating with teammates during collaborative work
  • Using Git in a realistic team environment
  • SSH authentication for secure Git operations

Real-World Applications:

These skills are exactly what you'll use at work:

  • This workflow is identical across GitHub, GitLab, Bitbucket, Azure DevOps, and any Git server
  • Professional teams do this hundreds of times per day
  • Understanding merge conflicts is critical for team collaboration
  • Push rejections happen constantly in real teams - you now know how to handle them
  • SSH authentication is the industry standard for secure Git operations

You're now ready to:

  • Contribute to open source projects on GitHub
  • Join a development team and collaborate effectively
  • Handle merge conflicts without panic
  • Understand the fundamental push/pull workflow
  • Work on distributed teams across time zones

What's Next?

More Advanced Git Modules

Continue your Git journey with advanced techniques:

  • 02-advanced/01-rebasing: Learn to rebase instead of merge for cleaner history
  • 02-advanced/02-interactive-rebase: Clean up messy commits before submitting PRs
  • 02-advanced/03-worktrees: Work on multiple branches simultaneously
  • 02-advanced/04-bisect: Find bugs using binary search through commit history
  • 02-advanced/05-blame: Investigate who changed what and when
  • 02-advanced/06-merge-strategies: Master different merge strategies and when to use them

Practice More

  • Try contributing to a real open source project on GitHub
  • Practice more complex workflows (multiple feature branches, rebasing, etc.)
  • Help teammates at work or school with Git issues

Congratulations!

You've completed the Multiplayer Git module!

You started this workshop learning basic Git commands like git init and git commit. Now you're collaborating with teammates, resolving conflicts, and handling push rejections like a professional developer.

What makes you different from most beginners:

  • You've experienced REAL merge conflicts and resolved them
  • You've worked on a REAL shared repository with teammates
  • You've experienced REAL push rejections and learned how to handle them
  • You've practiced the entire workflow professionals use daily

Most importantly: You're no longer afraid of merge conflicts or push rejections. You know exactly what to do when you see those <<<<<<< markers or get a "rejected" error.

Keep practicing, keep collaborating, and welcome to the world of professional Git!


Happy Collaborating!