← Back to Git Course | Chapter 1: Introduction & Setup | Lesson 6 of 7

Git Workflow Overview

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

bash
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)

bash
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)

bash
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

bash
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

bash
git log
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.