================================================================================ WORK WITH ME WEDNESDAY - GIT BASICS ================================================================================ CLASS INFO: ----------- Topic: [GIT TOPIC - e.g., "Version Control Fundamentals"] Date: [YYYY-MM-DD] Duration: [60 minutes] Level: [Beginner/Intermediate] Instructor: [NAME] LEARNING OBJECTIVES: -------------------- By the end of this session, students will be able to: • [Objective 1 - e.g., Initialize a Git repository] • [Objective 2 - e.g., Create commits with meaningful messages] • [Objective 3 - e.g., Push code to GitHub] • [Objective 4 - e.g., Understand basic branching] PREREQUISITES: -------------- • Git installed (check: git --version) • GitHub account created • Text editor installed (VS Code, nano, etc.) • Basic terminal familiarity SETUP (5 MIN): -------------- 1. Open terminal 2. Navigate to workspace: cd ~/Desktop 3. Verify git: git --version 4. Configure if needed: git config --global user.name "Your Name" git config --global user.email "your.email@example.com" HANDS-ON EXERCISES: ------------------- Exercise 1: [TITLE - e.g., "Initialize Repository"] ---------------------------------------------------- Commands: mkdir [PROJECT_NAME] cd [PROJECT_NAME] git init ls -la # Show .git directory Expected output: Initialized empty Git repository Exercise 2: [TITLE - e.g., "First Commit"] ---------------------------------------------------- Commands: echo "# My Project" > README.md git status git add README.md git commit -m "Initial commit" git log Expected output: [main xxxxx] Initial commit Exercise 3: [TITLE - e.g., "Push to GitHub"] ---------------------------------------------------- Commands: # Create repo on GitHub first git remote add origin https://github.com/[USERNAME]/[REPO].git git push -u origin main Expected output: Branch "main" set up to track "origin/main" Exercise 4: [TITLE - e.g., "Branching Basics"] ---------------------------------------------------- Commands: git branch feature-branch git checkout feature-branch # Make changes git add . git commit -m "Add feature" git checkout main git merge feature-branch Expected output: Fast-forward merge COMMON ERRORS & SOLUTIONS: --------------------------- Error 1: "fatal: not a git repository" Solution: Run git init first, or cd into correct directory Error 2: "Permission denied (publickey)" Solution: Set up SSH keys or use HTTPS URL Error 3: "Your branch is ahead of "origin/main"" Solution: git push to sync changes Error 4: "Merge conflict" Solution: Edit conflicted files, then git add and git commit PRACTICE CHALLENGES: -------------------- 1. [Challenge 1 - e.g., "Create a new branch and commit 3 files"] 2. [Challenge 2 - e.g., "Fork a public repo and clone it locally"] 3. [Challenge 3 - e.g., "Revert a commit using git revert"] CHEAT SHEET: ------------ git init # Initialize repository git status # Check status git add [file] # Stage file git commit -m "msg" # Commit with message git push # Push to remote git pull # Pull from remote git branch # List branches git checkout [branch] # Switch branches git log # View history RESOURCES & NEXT STEPS: ----------------------- • Documentation: https://git-scm.com/docs • Interactive tutorial: https://learngitbranching.js.org • GitHub guides: https://guides.github.com • Next class: [TOPIC] • Practice repo: [URL] INSTRUCTOR NOTES: ----------------- [Add specific notes, student questions, modifications made during class] ================================================================================