Domdhi logoDOMDHI.OS
BACK_TO_COURSE

Git Fundamentals — What Version Control Actually Is

Reading `git log` and `git diff` Like You Mean It

History Is Only Useful If You Can Read It

git log is where most people either get lost in a wall of hashes or never open it at all. A few flags turn it into an actual tool:

git log --oneline --graph --decorate     # the shape of history, one line per commit
git log -p -- path/to/file.ts             # every change ever made to one file
git log --author="Dom"                    # filter by author
git diff                                    # working dir vs. staging
git diff --staged                           # staging vs. last commit
git diff main..feature-branch                # what a branch actually changed

.gitignore Is Not Optional

Anything generated (node_modules/, build output, .env secrets, IDE config) belongs in .gitignore, never in a commit. If a file was accidentally committed before it was ignored, adding it to .gitignore after the fact does nothing — it has to be explicitly removed from tracking with git rm --cached.

WARNING

"I added it to .gitignore but it's still showing up" almost always means the file was already committed once, historically, before the ignore rule existed. gitignore only blocks new untracked files.

QUIZ

You added `secrets.env` to `.gitignore`, but `git status` still shows it as tracked. Why?

Sign in to track lesson progress and earn a certificate.SIGN IN TO SAVE PROGRESS