Process Flow - Clean vs dirty working directory
Start: Working Directory
Check for changes?
Clean
Ready for
This flow shows how Git checks your working directory for changes. If no changes, it's clean; if changes exist, it's dirty.
Jump into concepts and practice - no test required
git status # Shows if working directory is clean or dirty
| Step | Command | Working Directory State | Git Output Summary | Next Action |
|---|---|---|---|---|
| 1 | git status | No changes | "working tree clean" | Ready for next commit |
| 2 | touch file.txt | New untracked file | "Untracked files:" list shown | Add or ignore file |
| 3 | git add file.txt | File staged | "Changes to be committed:" list shown | Commit or unstage |
| 4 | echo 'change' > file.txt | Modified staged file | "Changes not staged for commit:" list shown | Add changes or discard |
| 5 | git commit -m 'Add file.txt' | No changes | "working tree clean" | Ready for next commit |
| Variable | Start | After Step 2 | After Step 3 | After Step 4 | After Step 5 |
|---|---|---|---|---|---|
| Working Directory | Clean | Dirty (untracked file) | Dirty (file staged) | Dirty (file modified) | Clean |
| Staging Area | Empty | Empty | file.txt staged | file.txt staged but modified | Empty |
Clean vs Dirty Working Directory in Git: - Clean: No changes or all changes committed. - Dirty: Untracked, modified, or staged changes exist. - git status shows state: 'working tree clean' means clean. - Use git add to stage changes. - Modify after staging requires re-adding to update staging.
clean?git status shows staged, unstaged, and untracked changes.git commit saves changes, git push uploads commits, git checkout switches branches or files.git status and see:Changes not staged for commit:
modified: app.js
git status:On branch main
Changes to be committed:
modified: index.html
git reset HEAD index.html unstages the file, showing if working directory has unstaged changes.app.py and README.md. You staged app.py but not README.md. What will git status show?