Post

10 - Trainer Guide

#10 - Trainer Guide

##Session Overview

Duration: 3-4 hours (with breaks)
Level: Beginner to Intermediate
Mode: Hands-on, terminal-based

##Learning Objectives

By the end of this session, graduates should be able to:

  1. Initialize and manage local Git repositories
  2. Stage and commit changes with clear messages
  3. Use .gitignore effectively
  4. Undo common mistakes safely
  5. Connect to and sync with remote repositories
  6. Use vi for basic terminal editing
  7. Apply Git commands confidently in daily work

##Session Structure

###Part 1: Setup and Basics (30 minutes)

Module: 01-setup-and-basics.md

  • Verify Git installation on all machines
  • Configure user.name and user.email
  • Explain Git’s three-area model (working directory staging repository)
  • Demo: Initialize repository and check status

Trainer Tips:

  • Have students verify git --version first
  • Emphasize that staging area is unique to Git (vs. other VCS)
  • Show visual diagram of the three areas
  • Common issue: Students forget to cd into the right directory

###Part 2: Local Workflow (45 minutes)

Module: 02-local-workflow.md

  • Demo full cycle: add commit modify diff add commit
  • Show git log with flags: --oneline --graph --decorate
  • Introduce .gitignore with practical examples

Trainer Tips:

  • Walk through each command slowly first time
  • Emphasize git status as safety check habit
  • Show diff before and after staging (unstaged vs. staged)
  • Discuss .gitignore patterns: *.log, node_modules/, etc.

Common Questions:

  • Q: “Why do we need staging area?”
    A: Allows selective commits, reviewing changes before finalizing
  • Q: “What if I forget commit message?”
    A: Git opens default editor (vi/nano); we’ll learn vi shortly

###Break (10 minutes)

###Part 3: Fixing Mistakes (30 minutes)

Module: 04-fixing-mistakes.md

  • Demo unstaging: git reset HEAD <file>
  • Demo uncommitting: git reset --soft <hash>
  • Emphasize: --soft keeps changes, --hard destroys them

Trainer Tips:

  • Create mistakes intentionally for demonstration
  • Show git log --oneline to find correct commit hash
  • Warn about --hard: only use when certain
  • Mention modern alternative: git restore --staged

Safety Check:

  • Before moving on, have each student successfully unstage a file
  • Verify they can view commit history and identify commit hashes

###Part 4: Remote Collaboration (40 minutes)

Module: 05-remote-collaboration.md

Prerequisites: Students should have GitHub/GitLab accounts ready

  • Demo creating remote repository (GitHub/GitLab UI)
  • Show git remote add origin <url>
  • Explain -u flag in git push -u origin main
  • Demo fetch diff pull workflow

Trainer Tips:

  • SSH vs. HTTPS: Use HTTPS for simplicity unless SSH keys are pre-configured
  • Simulate team collaboration by adding commits via browser
  • Explain upstream tracking: why -u is used once, then just git push
  • Show git remote -v to verify remote connection

Common Issues:

  • Authentication failures: Have students verify credentials
  • Branch name mismatch: main vs. master
  • First push failure: May need to pull first if remote has README

###Break (10 minutes)

###Part 5: vi Quick Guide (25 minutes)

Module: 03-vi-quick-guide.md

  • Why vi? Available on all Unix/Linux systems, useful for SSH sessions
  • Demo modes: Normal, Insert, Command-line
  • Practice: Open file, insert text, save, quit

Trainer Tips:

  • Reassure students: vi is intimidating at first but powerful
  • Focus on essentials: i, Esc, :wq, :q!
  • Have students follow along with 5-minute practice
  • Bonus: Mention vim as enhanced version

Most Common Trap:

  • Students forget to press Esc before :wq and get confused
  • Tip: “When in doubt, press Esc twice, then try command”

###Part 6: Cheat Sheet & Practice Lab (30 minutes)

Module: 08-cheatsheet-and-practice.md

  • Review essential commands cheat sheet
  • Discuss good habits for professional work
  • Supervised 30-minute practice lab (students work independently)

Trainer Tips:

  • Circulate and help students individually
  • Encourage students to reference earlier modules
  • Have students pair up if stuck
  • Goal: Complete flow end-to-end without help

###Part 7: Assessment (20 minutes)

Module: 09-student-worksheet.md

  • Distribute worksheet (digital or printed)
  • Students complete Parts A-E individually
  • Part F: Mini challenge with trainer verification

Grading Rubric:

  • Part A-D (Concepts): 40%
  • Part E (vi): 20%
  • Part F (Practical): 40%

##Troubleshooting Guide

###Issue: “fatal: not a git repository” Solution: Student not in correct directory. Run git init or cd to repo.

###Issue: “Author identity unknown” Solution: Run git config --global user.name and user.email.

###Issue: “refusing to merge unrelated histories” Solution: Remote has commits local doesn’t have. Use git pull --rebase or start fresh.

###Issue: vi shows “E212: Can’t open file for writing” Solution: File permissions issue. Use :q! to exit, check file/directory permissions.

###Issue: “fatal: remote origin already exists” Solution: Remote already added. Use git remote set-url origin <new-url> to change.

##Extension Activities

For fast learners who finish early:

  1. Branching Preview: Create a feature branch, make commits, switch back to main
  2. Merge Conflict: Create conflict intentionally and resolve it
  3. Git Aliases: Set up shortcuts like git config --global alias.st status
  4. Interactive Rebase: Clean up commit history before pushing

##Assessment Criteria

Excellent: Completes all tasks independently, uses git status regularly, writes clear commit messages
Good: Completes most tasks with minimal help, understands core concepts
Needs Improvement: Requires frequent guidance, struggles with basic commands

##Post-Session Resources

Share with students:

##Trainer Preparation Checklist

  • Verify Git installed on all lab machines
  • Ensure internet access for remote repository operations
  • Prepare example repository for demonstration
  • Have backup exercises ready for fast learners
  • Test all commands on lab environment beforehand
  • Prepare visual diagrams for three-area model
  • Have GitHub/GitLab account creation instructions ready

##Feedback Collection

At session end, ask:

  1. Which concept was hardest to understand?
  2. Which command will you use most in your work?
  3. What additional Git topics interest you?

Use feedback to adjust pacing and emphasis in future sessions.

This post is licensed under CC BY 4.0 by the author.