Files
git-workshop/module-01-basics/README.md
2025-12-19 11:27:57 +01:00

62 lines
1.8 KiB
Markdown

# Module 01: Git Basics
## Learning Objectives
- Understand what a git repository is
- Learn the basic git workflow: modify → stage → commit
- Use `git status` to check repository state
- Use `git add` to stage changes
- Use `git commit` to save changes
## Challenge
In this challenge, you'll learn the fundamental git workflow.
### Setup
Run the setup script to prepare the challenge:
```powershell
.\setup.ps1
```
This will create a directory called `challenge` with some files that need to be committed.
### Your Task
1. Navigate into the `challenge` directory: `cd challenge`
2. **Initialize a new git repository**: `git init` (this is your first step!)
3. Check the status of your repository: `git status`
4. Stage the file `welcome.txt`: `git add welcome.txt`
5. Create a commit with the message "Add welcome file": `git commit -m "Add welcome file"`
6. Stage the file `instructions.txt`: `git add instructions.txt`
7. 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
```bash
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:
```powershell
.\verify.ps1
```
This will check if you've successfully completed all the steps.