Status, Log & .gitignore

Seeing What's Going On

CommandShows
git statusWhat's changed, staged, or untracked
git logCommit history
git log --onelineCompact one-line-per-commit history
git diffLine-by-line unstaged changes
git diff --stagedWhat's staged for the next commit
$ git log --oneline
a1b2c3d Add readme
9f8e7d6 Initial commit
Tip: git status is your best friend - run it constantly. It literally tells you what to do next (how to stage, unstage, or discard).

.gitignore - keep junk out

Some files should never be committed: secrets, build artifacts, dependencies. List them in a .gitignore file and Git pretends they don't exist.

# .gitignore
node_modules/
.env
*.log
dist/
Danger: Never commit secrets (.env, API keys, private keys). Once pushed, they're in history forever - even deleting them later doesn't remove them from past commits. Add them to .gitignore before the first commit.