✕ Close
← Why save points?

Level 7 · Lesson 53: Your first commit

Time travel with Git →
INTRODUCTION
Your first save point
Pick the files, then save them with a note.
press Enter ↵
💾 Save points on main
  1. No save points yet. Pick files with git add, then git commit.
+ images/cat.png+ index.html+ style.css

Windows PowerShell (practice mode: nothing here touches your real computer)

 

Lesson 53: Your first commit

Level 7, Save Points: Git and GitHub. Pick files with git add, save them with git commit. The new word: commit. It follows lesson 52, Why save points?. Next comes lesson 54, Time travel with Git.

What the lesson explains

Your first save point. Pick the files, then save them with a note.

Pick, then save. git add picks the files. git commit saves them. git add picks; git commit saves; -m "…" the note.

What you do first

Pick the files. In the practice terminal, type git add . at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>.

The files on the practice computer

This lesson works in one folder. At the start, Documents\my-site holds images\, index.html, style.css.

Along the way you type git add ., type git commit -m "My About Me page", type echo "Ideas: a games page" > ideas.txt, type git add ideas.txt, type git commit -m "Add my ideas", type echo "Add a games page" > todo.txt, type git add todo.txt and type git commit -m "Add a to-do list". Lesson 54 opens with the files just as you leave them.

What you practise

Try it, "Pick the files": In the practice terminal, type git add . at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>. Then: In the practice terminal, type git status at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: On branch main / No commits yet / Changes to be committed: / (use "git restore --staged <file>..." to unstage) / new file: images/cat.png / new file: index.html / new file: style.css.

Try it, "Save!": In the practice terminal, type git commit -m "My About Me page" at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: [main (root-commit) 8fa9095] My About Me page / 3 files changed / create mode 100644 images/cat.png / create mode 100644 index.html / create mode 100644 style.css. Then: In the practice terminal, type git log at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: commit 8fa9095 (HEAD -> main) / Author: You <you@example.com> / My About Me page.

Try it, "Change, pick, save": In the practice terminal, type echo "Ideas: a games page" > ideas.txt at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>. It makes ideas.txt. Then: In the practice terminal, type git add ideas.txt at the prompt PS C:\Users\you\Documents\my-site>; the prompt then reads PS C:\Users\you\Documents\my-site>. Then: In the practice terminal, type git commit -m "Add my ideas" at the prompt PS C:\Users\you\Documents\my-site> and the computer answers: [main adc97b5] Add my ideas / 1 file changed / create mode 100644 ideas.txt.

In your head, "Picked or not?": You change style.css but do not git add it. Is it in your next save? The answer: "No: only picked files".

Challenge, "A to-do list": Make todo.txt and save it in a new save point. Starting at PS C:\Users\you\Documents\my-site>, one way takes 3 commands: echo "Add a games page" > todo.txt; git add todo.txt; git commit -m "Add a to-do list" (par: 3).

What PlayBuddy and PlayType say

PlayBuddy: "A commit is a save point with a note. Let’s make one!"

PlayType: "First pick the files with git add. Then commit saves them."

Help in every lesson

Everything happens on a pretend computer in your browser, so nothing touches your real files. PlayBuddy and PlayType stand beside the board, cheer you on and say when it is your turn.

A green ring shows where to click the first time. After that you do it on your own, and if you slip twice the ring comes back.

Stars

The lesson has 9 things to do. Up to one slip in ten gives three stars, up to one in four gives two, and finishing always gives at least one. Stars and progress are saved in this browser only; there is no account.

About DayOneCode

DayOneCode is an independent learning site, not affiliated with or endorsed by Anthropic. Claude and Claude Code are trademarks of Anthropic.