60 lines
1.5 KiB
Markdown
60 lines
1.5 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
|
|
2. Initialize a new git repository
|
|
3. Check the status of your repository
|
|
4. Stage the file `welcome.txt`
|
|
5. Create a commit with the message "Add welcome file"
|
|
6. Stage the file `instructions.txt`
|
|
7. Create a commit with the message "Add instructions"
|
|
|
|
### 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.
|