Module 01: Git Basics
Learning Objectives
- Understand what a git repository is
- Learn the basic git workflow: modify → stage → commit
- Use
git statusto check repository state - Use
git addto stage changes - Use
git committo save changes
Challenge
In this challenge, you'll learn the fundamental git workflow.
Setup
Run the setup script to prepare the challenge:
.\setup.ps1
This will create a directory called challenge with some files that need to be committed.
Your Task
- Navigate into the
challengedirectory:cd challenge - Initialize a new git repository:
git init(this is your first step!) - Check the status of your repository:
git status - Stage the file
welcome.txt:git add welcome.txt - Create a commit with the message "Add welcome file":
git commit -m "Add welcome file" - Stage the file
instructions.txt:git add instructions.txt - Create a commit with the message "Add instructions":
git commit -m "Add instructions"
Note: The challenge directory is NOT a git repository until you run git init. This is intentional - you're learning to start from scratch!
Key Concepts
- Repository: A directory tracked by git, containing your project files and their history
- Working Directory: The files you see and edit
- Staging Area (Index): A preparation area for your next commit
- Commit: A snapshot of your staged changes
Useful Commands
git init # Initialize a new git repository
git status # Show the working tree status
git add <file> # Stage a file for commit
git commit -m "<message>" # Create a commit with a message
Verification
Once you think you've completed the challenge, run:
.\verify.ps1
This will check if you've successfully completed all the steps.