Git

Lesson 01

Status before work

Start every change by checking branch, cleanliness, and upstream state so you do not build on the wrong base.

Good Code

review-start.sh
# Confirm branch and local changes before editing.
git status --short --branch
git fetch origin
git status --short --branch
git diff --stat

Bad Code

review-start.sh
# Pulling first can hide which base changed under you.
git pull
code src/app.ts
git add .
git commit -m "updates"

Review Notes

What to review

Good Code

The good version checks the current branch, working tree, remote state, and visible diff before making a decision.

Bad Code

The bad version pulls first, starts editing, and commits everything without proving which branch it is on or what changed.

Takeaways

  • A good Git workflow begins by making the current branch and uncommitted changes visible before editing files.