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:
- Initialize and manage local Git repositories
- Stage and commit changes with clear messages
- Use .gitignore effectively
- Undo common mistakes safely
- Connect to and sync with remote repositories
- Use vi for basic terminal editing
- 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 --versionfirst - Emphasize that staging area is unique to Git (vs. other VCS)
- Show visual diagram of the three areas
- Common issue: Students forget to
cdinto 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 statusas 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:
--softkeeps changes,--harddestroys them
Trainer Tips:
- Create mistakes intentionally for demonstration
- Show
git log --onelineto 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
-uflag ingit 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
-uis used once, then justgit push - Show
git remote -vto verify remote connection
Common Issues:
- Authentication failures: Have students verify credentials
- Branch name mismatch:
mainvs.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
Escbefore:wqand get confused - Tip: “When in doubt, press
Esctwice, 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:
- Branching Preview: Create a feature branch, make commits, switch back to main
- Merge Conflict: Create conflict intentionally and resolve it
- Git Aliases: Set up shortcuts like
git config --global alias.st status - 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:
- Official Git Documentation
- GitHub Learning Lab
- Oh My Git! (Game)
- Next module: Branching and Merging (Module 09)
##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:
- Which concept was hardest to understand?
- Which command will you use most in your work?
- What additional Git topics interest you?
Use feedback to adjust pacing and emphasis in future sessions.