0/3

Lesson08

beginner

Create Your First Commit

Goal

Record staged changes as a commit with a clear message.

A commit saves everything in the staging area as a permanent snapshot in the repository's history. Each commit needs a message that explains the change.

Commit README.md on its own first, then commit the rest.

Objectives

0/3
  1. Stage README.md on its own. (Current objective)
  2. Commit it with the message Add README. (Not started)
  3. Commit the remaining file so the working tree is clean. (Not started)

Your task nowStep 1 of 3

Stage README.md on its own.

Need help?

Reference

Anatomy of a commit

$ git commit -m "Add README"

[main (root-commit) 3f2a91c] Add README
 1 file changed
 create mode 100644 README.md
  • main is the branch the commit was made on.
  • root-commit means this is the very first commit, with no parent.
  • 3f2a91c is the start of the commit's unique ID, its hash.
  • The last lines summarize which files the commit changed.

Writing a good message

Write the message as a short command that completes the sentence "This commit will...": Add README, Fix login redirect, Update forecast colors. Aim for under 50 characters.

Preparing your workspace…

Repository Graph

Click a commit to inspect it

0 commits

Working Tree

Not a Git repository yet

No unstaged changes

Your working tree matches the staging area.

Staging Area

Files prepared for the next commit

No staged changes

Use git add to prepare files for your next commit.

Repository

Committed history

No commits yet

Use git commit to record staged changes.