Add lesson 8: A tidy history with rebase
3 changed files with 28 additions and 0 deletions
lessons/08-a-tidy-history-with-rebase/README.md ADDED
| @@ -0,0 +1,19 @@ | ||
| 1 | +# Lesson 8: A tidy history with rebase | |
| 2 | + | |
| 3 | +A tidy history with rebase 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/8](https://glibcode.net/courses/git-github/lessons/8) | |
| 6 | + | |
| 7 | +## Files | |
| 8 | + | |
| 9 | +- `commands.sh`: interactive rebase to tidy a branch before merging | |
| 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/08-a-tidy-history-with-rebase/commands.sh ADDED
| @@ -0,0 +1,4 @@ | ||
| 1 | +git switch feature/search | |
| 2 | +git rebase -i main | |
| 3 | +# in the editor: pick the first commit, squash the "wip" ones into it | |
| 4 | +git push --force-with-lease | |
lessons/08-a-tidy-history-with-rebase/exercises.md ADDED
| @@ -0,0 +1,5 @@ | ||
| 1 | +# Exercises: lesson 8 | |
| 2 | + | |
| 3 | +1. Combine this lesson with the previous one: use something from both in a small program of your own. | |
| 4 | +2. Look up one function or command the example uses in the official documentation. Note one option you didn't know. | |
| 5 | +3. Time yourself: rewrite the example from memory in 10 minutes, then diff it against the original. | |