First steps · lesson 8 of 8
Commands and ideas in this lesson
Agit initfrom lesson 1.4
B.gitignorefrom lesson 1.6
Cgit add, git commitfrom lessons 1.4 and 1.5
DGood messagesfrom lesson 1.7

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:

  1. Make it a repository.
  2. Write a .gitignore that keeps out what the script made.
  3. Commit each recipe in its own commit, with a message following lesson 1.7.
  4. Write a short README.md saying what Kusina is (use edit README.md), and commit it with the script and .gitignore.

There's no single right order. Use git status often.

Build it

Git sandbox
  1. Make kusina a repository
  2. Never commit index.html or anything in __pycache__
  3. Commit each of the five recipes in a commit of its own
  4. Commit a README.md and the script
  5. Every message is a short command that says what changed
  6. 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

Spot the trapAna

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.

Why write .gitignore before the first commit, rather than after?
Five recipes, five commits. What does that give Ana that one commit wouldn’t?

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