Unit 08 · lesson

Initialize and Read Git History

Version control becomes useful when you read it as evidence, not when you memorize commands.

Check repository state

If the project is already a Git repository, do not blindly run initialization again. Start with:

git status

If the project is not a repository and your environment is intended for Git work, initialize it:

git init

Then inspect status again.

Configure identity appropriately

Git commits record author identity. Use the account/name/email policy appropriate for your classroom or public project.

Do not publish an email address you did not intend to expose through commit metadata.

Your instructor/environment may already configure this.

First meaningful snapshot

Before committing, inspect what Git sees:

git status

Stage deliberately:

git add <files-you-actually-reviewed>

Inspect staged changes:

git diff --staged

Then commit with a message describing one coherent change.

Read history

git log --oneline --decorate --graph

The exact flags are less important than learning to answer:

  • Which commit is current?
  • What came before it?
  • What message explains each change?
  • Is the history one understandable series of decisions or a pile of stuff commits?

Do not stage everything as a reflex

git add . can be useful.

It can also stage something you did not mean to publish.

Before a public commit, inspect status/diff.

Portfolio action

Create one clean commit for a real current state of the portfolio.

Checkpoint

Save:

Commit SHA (short is fine):
Commit message:
Files changed:
Why these files belong in one commit: