Capstone: Kusina, for real · lesson 2 of 6
Commands and ideas in this lesson
A.gitignore1.6: what stays out
Bgit diff --staged2.2: check before committing
Cgit commit1.7: one change, one clear message
Dgit push -u origin main4.6: share it

Lola Remy’s notebook

Last updated

Ana sits down with Lola Remy's notebook and types it up: twenty recipes, each in its own file, each in its own commit. Before the first recipe goes in, she decides what stays out and writes a README. By the end of this lesson the shared Kusina has a history anyone could read.

By the end of this lesson you can

  • Start a real repository with a .gitignore and a README
  • Make twenty small commits with clear messages, checking each before committing
  • Push the history and pull it into the second clone

What stays out

Work in Ana's folder, ~/ana-kusina, for this whole lesson.

Before any recipe, decide what Git should never pick up (lesson 1.6). Kusina will hold Markdown files. Your editor and your system may leave their own files around, and the photo password from lesson 7.6 will live in a .env file. Make .gitignore with:

.gitignore
# Files systems and editors make
.DS_Store
Thumbs.db
.vscode/
*.swp

# Secrets: never committed (lesson 7.6)
.env

# Photos and videos live on the family photo site (lesson 7.5)
*.jpg
*.mp4

Commit it on its own:

Terminal
git add .gitignore
git commit -m "Ignore editor files, secrets and media"

A README

The README is the first thing anyone sees. Say what Kusina is, how it's organised, and how to add to it. Write your own, or start from this:

README.md
# Kusina

Lola Remy’s recipes, typed up from her notebook so the family can cook
them, correct them and add their own.

Each recipe is one Markdown file, named after the dish: adobo.md.
Every recipe has a short description, an Ingredients list and numbered Steps.

To add or fix a recipe, make a branch, commit, and open a pull request.
Someone else reviews it before it goes into main.

Commit it: git add README.md, then a message like Add a README.

Twenty recipes, twenty commits

Here is the notebook. For each recipe: make the file with the name shown, paste the text (or type it, as Ana did), then check and commit it.

adobo.md

# Chicken adobo

Lola Remy's recipe. Serves 4.

## Ingredients

- 1 kg chicken, cut into pieces
- 1/2 cup soy sauce
- 1/3 cup vinegar
- 1 head garlic, crushed
- 3 bay leaves
- 1 tsp whole peppercorns
- a little salt

## Steps

1. Put everything in a pot and leave it for 30 minutes.
2. Bring to a boil, then simmer for 30 minutes.
3. Take the lid off and cook until the sauce is thick.

For each one, the same rhythm:

Terminal
git add tinola.md
git diff --staged
git commit -m "Add chicken tinola recipe"
  • One recipe per commit. Each is one change, and C.5 will rely on it.
  • A message that says what it does, in the imperative: Add chicken tinola recipe, not stuff or added files.
  • git diff --staged before each commit. It's how you catch a stray file or a paste that went wrong.
  • If you notice a typo in the commit you just made and haven't pushed yet, git commit --amend (lesson 2.4).

It's repetitive on purpose. By the twentieth, the rhythm will be automatic, and that habit is most of what makes a history useful.

Share it

Push main and set it as the upstream (lesson 4.6), then fetch it as Carla:

Terminal
git push -u origin main
...
 * [new branch]      main -> main
branch 'main' set up to track 'origin/main'.
cd ~/carla-kusina
git pull
...
ls
README.md  adobo.md  arroz-caldo.md  bibingka.md  ...

Carla's clone was empty, so the first git pull simply brings everything in.

Check your history

In either folder:

Terminal
git log --oneline | head -4
3f2a9c1 (HEAD -> main, origin/main) Add green mango salad recipe
8b7e6d5 Add maja blanca recipe
1c0d9e8 Add puto recipe
7a6b5c4 Add halo-halo recipe
git log --oneline | wc -l
22
git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

You should have 22 commits (or more, if you split something sensibly), a clean working tree, and origin/main at the same commit as main.

Why does each recipe get its own commit?
Why was .gitignore the very first commit?

Sources

Every command on this page behaves as these pages describe, and the sandbox prints what Git 2.55 prints. Hosting features (pull requests, protected branches) come from the host’s own documentation.

All sources for Simple Git