Tour of Git
Git Basics / Lesson 1.10

The Complete Git Workflow

Now that you know the fundamental commands, let's see how they fit together into a daily workflow. This is the cycle you'll repeat hundreds of times as a developer.

The Core Loop

Every change you make in Git follows this pattern:

Edit  -->  Status  -->  Add  -->  Commit
  ^                                  |
  |                                  |
  +----------------------------------+
  1. Edit your files in your editor
  2. Status — run git status to see what changed
  3. Add — stage the changes you want with git add
  4. Commit — save a snapshot with git commit
  5. Repeat

A Typical Session

Here's what a real workflow looks like:

# 1. Check where you are
git status

# 2. Make your changes
# (edit files in your editor)

# 3. Review what changed
git diff

# 4. Stage specific files
git add src/feature.js
git add src/feature.test.js

# 5. Double-check what's staged
git diff --staged

# 6. Commit with a clear message
git commit -m "Add user profile feature"

# 7. Verify in the log
git log --oneline -3

Choosing What to Commit

Not every change needs to go into the same commit. Good practice is to make small, focused commits that each do one thing:

  • One bug fix = one commit
  • One feature = one commit (or a small series)
  • Refactoring = separate commit from behavior changes

Use git add selectively to stage only the files relevant to each commit.

The Mental Model

Think of your Git workflow as three areas:

AreaWhat lives thereCommand to move forward
Working directoryYour current editsgit add
Staging areaChanges ready to commitgit commit
RepositoryPermanent historygit log to view

Files flow from left to right. You control exactly what moves forward at each step.

Quick Reference

CommandPurpose
git statusSee what has changed
git diffSee unstaged changes in detail
git add <file>Stage a file for commit
git diff --stagedSee staged changes in detail
git commit -m "msg"Save a snapshot
git log --onelineView recent history
git commit --amendFix the last commit

What's Next?

With these basics mastered, you're ready to learn about branching — Git's killer feature that lets you work on multiple things at once without them interfering with each other.