After making a repository and a first commit, the next job is learning how to inspect what is happening.
Three commands matter immediately:
git statusgit diffgit log
git status tells you the current state of the repository
Run:
git status
This shows:
- which branch you are on
- which files changed
- which files are staged
- which files are untracked
For beginners, git status is the safest command to run when you are unsure what is happening.
Quick Check
One answerWhat does git status NOT show?
Choose the best answer and use it to track your progress through the lesson.
Why that answer is correct
git status shows the repository state (branch, staged files, untracked files) but not the actual content of changes. For that, use git diff.
It is also one of the best places to reinforce the three-state model:
- some changes are only in the working tree
- some changes are staged for the next commit
- some changes are already part of commit history
git diff shows the actual content changes
To see unstaged changes:
git diff
To see what is already staged for the next commit:
git diff --staged
This distinction matters:
git diffshows what changed in the working tree but is not staged yetgit diff --stagedshows what Git would include if you committed now
That means git diff --staged is one of the best commands to run right before git commit.
git log shows commit history
To inspect the history:
git log
A shorter common view is:
git log --oneline
That gives a compact list of recent commits with short identifiers and commit messages.
Quick Check
One answerWhat does git log --oneline display?
Choose the best answer and use it to track your progress through the lesson.
Why that answer is correct
git log --oneline gives a compact view: each commit as a short hash plus its message. For full diffs, use git log -p instead.
A practical inspection habit
Before making a commit, a strong habit is:
- run
git status - run
git diff - stage the intended files
- run
git diff --staged - commit
That helps you verify the next commit before it becomes part of history.
It also helps prevent a common beginner mistake: assuming Git will automatically commit everything you edited just because the file changed on disk.
.gitignore matters here too
Many repositories include a .gitignore file.
.gitignore tells Git which files or directories should usually be ignored instead of showing up as untracked files.
Common examples include:
- build output
- environment files
- dependency directories
- editor-specific files
The main idea to keep
Git is easier when you inspect before you act.
git status shows the repository state, git diff shows the content changes, and git log shows the history that already exists.