Files
git-workshop/README.md
2026-01-16 12:43:11 +01:00

11 KiB

Git Workshop

A hands-on Git workshop with 8 progressive modules covering essential Git skills from basic commits to real-world collaboration. Each module presents a practical scenario you must solve using Git commands, with automated verification to confirm your solution.

Perfect for developers who want to master Git fundamentals and professional workflows including branching, conflict resolution, and team collaboration.

Workshop Structure

Essentials - Core Git Skills (8 modules)

Master fundamental Git concepts and collaborative workflows:

  • Module 01: Git Basics - Initialize repositories, stage changes, make commits
  • Module 02: Viewing History - Use git log and git diff to explore project history
  • Module 03: Branching and Merging - Create branches and merge them
  • Module 04: Merge Conflicts - Resolve conflicts when branches have competing changes
  • Module 05: Cherry-Pick - Apply specific commits from one branch to another
  • Module 06: Git Revert - Safe undoing - preserve history while reversing changes
  • Module 07: Stash - Temporarily save work without committing
  • Module 08: Multiplayer Git - The Great Print Project - Real cloud-based collaboration with teammates

How to Use This Workshop

For Local Modules (01-07)

  1. Navigate to a module directory (e.g., 01-essentials/01-basics)
  2. Read the README.md to understand the challenge
  3. Run ./setup.ps1 to create the challenge environment
  4. Complete the challenge using git commands
  5. Run ./verify.ps1 to check if you've solved it correctly
  6. Move to the next module

Quick Reference: See GIT-CHEATSHEET.md for a comprehensive list of all Git commands covered in this workshop. Don't worry about memorizing everything - use this as a reference when you need to look up command syntax!

For Module 08: Multiplayer Git

This module is different! It uses Azure DevOps for authentic cloud-based collaboration:

  1. Navigate to 01-essentials/08-multiplayer
  2. Read the README.md for complete instructions
  3. No setup script - you'll clone from Azure DevOps (URL provided by facilitator)
  4. Work with a partner on shared branches
  5. Experience real merge conflicts and pull requests
  6. Use SSH keys for secure authentication (best practice)
  7. No verify script - success is visual (your code appears in the final output)

Facilitators: See 01-essentials/08-multiplayer/FACILITATOR-SETUP.md for server setup and workshop guidance.

Running PowerShell Scripts

Most modules include setup, verification, and reset scripts.

If you encounter an "execution policy" error when running scripts, open PowerShell as Administrator and run:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Then run scripts using:

.\setup.ps1
.\verify.ps1
.\reset.ps1

Requirements

Prerequisites

Install these tools before starting:

PowerShell 7+

winget install Microsoft.PowerShell

Git 2.23+

winget install Git.Git

Visual Studio Code

winget install Microsoft.VisualStudioCode

You can also run the one-shot install script if the project is cloned locally. It will check if you have the prerequisites install and clone down the project if not already cloned. Then it will configure git to have sane default.

./install.ps1

or if you don't have the project locally run.

REMEMBER read through the script before running it. As a general practice, you shouldn't get comfortable doing this kind of execution, and so it's important to review executing remote scripts.

Invoke-RestMethod -Uri https://git.frod.dk/floppydiscen/git-workshop/raw/branch/main/install.ps1 | Invoke-Expression

Quick Start

  1. Install the prerequisites above
  2. Clone this repository
  3. Configure Git (see below for recommended settings)

Git Configuration

Before starting the workshop, configure Git with your identity and recommended settings:

Required: Set Your Identity

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

Set VS Code as your default editor for commit messages, diffs, and merges:

# Set VS Code as the default editor
git config --global core.editor "code --wait"

# Set VS Code as the diff tool
git config --global diff.tool vscode
git config --global difftool.vscode.cmd "code --wait --diff $LOCAL $REMOTE"

# Set VS Code as the merge tool
git config --global merge.tool vscode
git config --global mergetool.vscode.cmd "code --wait --merge $MERGED"

Set "main" as the default branch name for new repositories:

git config --global init.defaultBranch main

Verify Your Configuration

Check that your settings are correct:

git config --global --list

Verify Installation:

Check that you have the required software installed:

# Git 2.23+
git --version

# PowerShell 7+
pwsh --version

Basic Command Line Knowledge

You should know how to:

  • Navigate directories (cd, ls or dir)
  • See your current location (pwd)
  • Read text files (cat or type)

Don't worry if you're not an expert - we'll guide you through each step!

Common Git Terms

New to Git? Here are the key terms you'll encounter:

  • Repository (or "repo"): A project folder tracked by Git, containing your files and their complete history
  • Commit: A snapshot of your project at a specific point in time (like a save point in a video game)
  • Staging Area: A preparation area where you select which changes to include in your next commit
  • Working Directory: The actual files you see and edit on your computer
  • Branch: An independent line of development (like a parallel universe for your code)
  • HEAD: A pointer showing which commit you're currently working from
  • main/master: The primary branch in a repository (main is the modern convention)
  • Merge: Combining changes from different branches
  • Remote: A version of your repository hosted elsewhere (like GitHub, GitLab, or Gitea)
  • Pull Request (PR): A request to merge your changes into another branch (used for code review)
  • Conflict: When Git can't automatically merge changes because both versions modified the same lines

Don't worry if these don't make sense yet - you'll learn them hands-on as you progress!

Getting Started

Once installed, start with Essentials Module 01:

cd 01-essentials\01-basics
.\setup.ps1

Follow the instructions in each module's README.md file.

What Makes This Workshop Different

  • Hands-On Practice: Each module creates a real Git scenario you must solve
  • Automated Verification: Scripts check your solution instantly (modules 01-07)
  • Progressive Difficulty: Builds from basics to advanced Git techniques
  • Reset Anytime: Each local module includes a reset script for a fresh start
  • Self-Paced: Learn at your own speed with detailed README guides
  • Real Collaboration: Module 08 uses an actual Git server for authentic teamwork
  • Comprehensive Coverage: From git init to advanced rebasing and bisecting

Learning Path

The modules are designed to build on each other:

Phase 1: Core Fundamentals (Essentials 01-02)

  • Git Basics, History
  • Goal: Understand commits and history

Phase 2: Collaboration Basics (Essentials 03-04)

  • Branching, Merging, and Conflict Resolution
  • Goal: Work with multiple branches and resolve conflicts

Phase 3: Workflow Tools (Essentials 05-07)

  • Cherry-Pick, Revert, and Stash
  • Goal: Manage your work effectively

Phase 4: Real Collaboration (Essentials 08)

  • Multiplayer Git - The Great Reordering of Numbers Project
  • Goal: Apply all skills with real teammates on a cloud server
  • Note: This is a capstone module - bring everything together!

Alternative Paths

Fast Track (half-day workshop):

  • Essentials 01-04 + Essentials 08 (Multiplayer)

Team Workshop:

  • Essentials 01-04 then jump to 08 (Multiplayer) for collaborative practice

Tips for Success

  • Don't skip modules - each builds on previous concepts
  • Read the README.md thoroughly before starting each challenge
  • Keep GIT-CHEATSHEET.md open as a quick reference
  • Experiment freely - you can always run ./reset.ps1 to start over
  • Use git status and git log --oneline --graph --all frequently to visualize repository state
  • If stuck, check the Key Concepts section in the module's README
  • For Module 08, work with a partner - collaboration is the point!

Skills You'll Master

By completing this workshop, you'll be able to:

  • Create and manage Git repositories with confidence
  • Navigate project history and understand what changed when
  • Use branches effectively for parallel development
  • Merge branches and resolve conflicts like a pro
  • Apply specific commits with cherry-pick
  • Safely undo changes with revert
  • Use stash to manage work-in-progress without commits
  • Collaborate with teammates on shared repositories
  • Resolve real merge conflicts in a team environment
  • Create and review pull requests
  • Use Git on a real cloud server (Azure DevOps)
  • Use SSH keys for secure Git authentication

These are professional-level Git skills used daily by developers at tech companies.


Repository Structure

git-workshop/
├── README.md                          # This file
├── INSTALLATION.md                    # Installation guide
├── install.ps1                        # Automated installation script
├── GIT-CHEATSHEET.md                  # Quick reference for all Git commands
├── BEST-PRACTICES.md                  # Git best practices
├── COMMIT-MESSAGES.md                 # Guide to writing good commit messages
├── WHAT-IS-GIT.md                     # Introduction to Git concepts
│
└── 01-essentials/                     # Core Git skills (8 modules)
    ├── 01-basics/                     # Initialize, commit, status
    ├── 02-history/                    # Log, diff, show
    ├── 03-branching-and-merging/      # Branches and merging
    ├── 04-merge-conflict/             # Resolve merge conflicts
    ├── 05-cherry-pick/                # Apply specific commits
    ├── 06-revert/                     # Safe undoing
    ├── 07-stash/                      # Save work-in-progress
    └── 08-multiplayer/                # Real collaboration (cloud-based)
        ├── README.md                  # Student guide
        ├── 01_FACILITATOR.md          # Facilitator setup guide
        └── 02_AZURE-DEVOPS-SSH-SETUP.md  # SSH authentication guide