# Git Exercises

## Exercise 1: Selective Staging

**Task:** Create three files: `a.txt`, `b.txt`, `c.txt`. Commit only `a.txt` and `c.txt` in one commit, then `b.txt` in a separate commit.

**Validation:**
- [ ] `git log` shows exactly 2 new commits
- [ ] First commit contains only `a.txt` and `c.txt`
- [ ] Second commit contains only `b.txt`

**Hints:**
1. Use `git add` with specific filenames
2. Check `git status` between steps to verify what's staged
3. `git add a.txt c.txt` then `git commit`, then `git add b.txt` then `git commit`

---

## Exercise 2: Undo a Mistake

**Task:** Make a commit with a typo in the file content. Then use `git revert` to undo it without losing history.

**Validation:**
- [ ] The typo commit exists in the log
- [ ] A revert commit follows it
- [ ] The file no longer contains the typo
- [ ] `git log` shows both the mistake and the fix

**Hints:**
1. Commit the typo normally
2. `git revert HEAD` creates a new commit that undoes the last one
3. Check the file content after reverting

---

## Exercise 3: Branch Workflow

**Task:** Simulate a feature branch workflow:
1. Create a `develop` branch from `main`
2. Create a `feature/login` branch from `develop`
3. Make 2 commits on `feature/login`
4. Merge `feature/login` into `develop`
5. Merge `develop` into `main`

**Validation:**
- [ ] `main` contains all changes from the feature branch
- [ ] The branch history shows the correct merge path
- [ ] `git branch` shows only `main` (clean up branches after merge)

**Hints:**
1. Use `git checkout -b` to create and switch in one step
2. After merging, delete branches with `git branch -d`
3. Use `git log --graph --oneline` to visualize the history
