Add lesson 3: Branches
3 changed files with 30 additions and 0 deletions
lessons/03-branches/README.md ADDED
| @@ -0,0 +1,19 @@ | ||
| 1 | +# Lesson 3: Branches | |
| 2 | + | |
| 3 | +Branches comes up in almost every real shell project. We start with the why, then write code together. | |
| 4 | + | |
| 5 | +Full lesson: [https://glibcode.net/courses/git-github/lessons/3](https://glibcode.net/courses/git-github/lessons/3) | |
| 6 | + | |
| 7 | +## Files | |
| 8 | + | |
| 9 | +- `commands.sh`: creating, switching and listing branches | |
| 10 | + | |
| 11 | +## Run it | |
| 12 | + | |
| 13 | +```sh | |
| 14 | +# type the commands from commands.sh one by one; don't run it as a script | |
| 15 | +``` | |
| 16 | + | |
| 17 | +## Exercises | |
| 18 | + | |
| 19 | +See [exercises.md](exercises.md). Ask in the forum once you've tried. | |
lessons/03-branches/commands.sh ADDED
| @@ -0,0 +1,6 @@ | ||
| 1 | +git switch -c feature/login | |
| 2 | +# ... edit files ... | |
| 3 | +git commit -am "Add login form" | |
| 4 | +git switch main | |
| 5 | +git merge feature/login | |
| 6 | +git branch --merged | |
lessons/03-branches/exercises.md ADDED
| @@ -0,0 +1,5 @@ | ||
| 1 | +# Exercises: lesson 3 | |
| 2 | + | |
| 3 | +1. Break the example on purpose: delete a bracket or misspell a name. Read the error message. Which line does it point to? | |
| 4 | +2. Find one thing in `commands.sh` you could name better and rename it everywhere. | |
| 5 | +3. Add a check that prints a warning when a result looks wrong (negative, empty, too big). | |