Kusina: the first recipes
Last updated
Time to start Kusina for real. You'll make the repository, keep out the files a program made, and commit Lola Remy's first five recipes one at a time, with messages the family can read.
By the end of this lesson you can
- Start a repository from a folder of existing files
- Ignore generated files before the first commit
- Make a series of small commits with good messages
The brief
Ana has typed up five recipes from Lola Remy's notebook: adobo, sinigang, leche flan, pancit and lumpia. Joaquin wrote build_index.py for her, which makes index.html, a page listing them all. She ran it once, so the folder also has index.html and Python's __pycache__ folder.
Your job, in the kusina folder:
- Make it a repository.
- Write a
.gitignorethat keeps out what the script made. - Commit each recipe in its own commit, with a message following lesson 1.7.
- Write a short
README.mdsaying what Kusina is (useedit README.md), and commit it with the script and.gitignore.
There's no single right order. Use git status often.
Build it
- Make
kusinaa repository - Never commit
index.htmlor anything in__pycache__ - Commit each of the five recipes in a commit of its own
- Commit a
README.mdand the script - Every message is a short command that says what changed
- Finish with nothing left to commit
You are in your home folder. ~/kusina holds five typed-up recipes, the index script, and two files the script made. It is not a repository yet.
Commit graph
You’re not in a project folder.
If a message isn't accepted, look again at lesson 1.7's rules: under 50 characters, a capital letter, no full stop, and a command such as "Add". Lesson 2.4 shows how to fix a message after committing; until then, Start over is fine.
Spot the trap: one giant commit
It’s late, and Ana is tempted: git add . then git commit -m "add recipes", and bed.
What happens if…
Check your history
Run git log --oneline in the sandbox. You should see seven or so lines, each a short command, newest first. That's what Lola Remy will read when she checks your work.
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.
- Pro Git: Recording Changes to the Repository: the whole Stage 1 cycle in one chapter
- Git documentation: gitignore: patterns
- Git documentation: git-commit, Discussion: the shape of a message