Course progress0%
Course content
40 min

From a Change to a Commit

Move one modification through Git's three places

By the end of this lesson

  • Distinguish working, staged and committed changes
  • Create and inspect one focused commit

Git has three places to understand

Use this simple model:

WORKING FOLDER
Files you are editing
       |
       | git add
       v
STAGING AREA
Changes chosen for the next version
       |
       | git commit
       v
LOCAL REPOSITORY
Versions recorded in history

The staging area is a preparation box. It lets you choose which changes belong in the next commit.

Prepare one file

git add index.html
git status

git add does not publish the file and does not create a commit. It prepares the current change to index.html for the next commit.

If you edit the same file again after adding it, Git can show one staged change and another unstaged change. Run git status and read both sections.

Record the prepared change

git commit -m "Add portfolio page heading"

A commit records the staged snapshot in the local history. The message explains the intention.

Inspect recent history:

git log --oneline

Each line shows a short commit identifier and its message.

What each action changes

Action Working file Staging area Local history GitHub
Save the file Changed Empty Unchanged Unchanged
git add index.html Changed Prepared Unchanged Unchanged
git commit Clean for that change Empty New commit Unchanged

See the complete movement

When a paragraph changes, status first reports a working-folder modification. After git add, it reports a staged change. After git commit, the staging area becomes empty and the new version appears in git log.

What to remember

Editing changes the working folder. add chooses changes for the next commit. commit records those staged changes locally. None of these commands sends work to GitHub.

Lesson complete?

Your progress is saved on this device.