Git Workflow Overview
In this page:
The Three Areas
Every file in a Git project sits in one of three areas at any moment: the Working Directory holds your raw edits, the Staging Area holds changes you've deliberately chosen for the next commit, and the Repository holds permanently saved history -- understanding this flow is the key to understanding almost every Git command.
Example: The Three Areas
git status
Tracking Changes (git add)
git add is the command that moves a file's current state from the Working Directory into the Staging Area, marking it as 'ready.' Nothing is saved to history yet -- staging is just you telling Git which changes belong together in the next snapshot.
Example: Tracking Changes (git add)
git add index.html
Committing Changes (git commit)
git commit -m "message" takes everything currently staged and permanently records it as a new snapshot in your project's history. A clear, specific message matters here -- six months from now, that message is often the only context you'll have for why a change was made.
Example: Committing Changes (git commit)
git commit -m "Add homepage"
Modifying Existing Files
Editing a file that's already been committed moves it back into the Working Directory as modified -- Git treats this as a brand-new change, so you have to git add it again before those edits can be included in your next commit.
Example: Modifying Existing Files
echo "Updated" >> index.html
git status
git add index.html
Reviewing the History Log
git log walks back through every commit ever made on the current branch, newest first, showing the author, date, and message for each -- it's the primary way to answer 'what actually happened to this project, and when.'
Example: Reviewing the History Log
git log
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: