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.