Lesson08
beginnerCreate 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- Stage
README.mdon its own. (Current objective) - Commit it with the message
Add README. (Not started) - 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
mainis the branch the commit was made on.root-commitmeans this is the very first commit, with no parent.3f2a91cis 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
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.
