git add -p is how professionals stage
git add file.js stages the entire file. git add . stages everything in the current directory. Both work for the simple case where every change in a file belongs in the same commit. The simple case is rare. Most real coding sessions touch unrelated things — a feature plus a typo, a bug fix plus a debug log you forgot to remove, a refactor plus a stray console.log. Lumping them into one commit hurts review and breaks bisect later.
The professional answer is git add -p (also --patch). It walks each "hunk" of changes and asks stage this one? You answer y (yes), n (no), s (split into smaller hunks), or e (manually edit the hunk). The result: one commit contains exactly the bug fix, another contains exactly the typo, another contains exactly the debug-log removal. History reads cleanly and bisect can isolate the failure.
The companion is git restore -p for unstaging or discarding hunks selectively, and git checkout -p for the older equivalent. Modern editors also have GUI hunk staging — VS Code's "Stage Selected Ranges," Tower, GitKraken, GitHub Desktop. Whichever you use, the muscle to build is "review every diff before commit," not "commit everything you happened to type today."
One refinement: git add -A stages all changes including deletions and untracked files in the entire repo. Convenient and dangerous — it is how unrelated test artifacts, secret .env edits, and accidental binaries end up in commits. Many seniors avoid -A entirely and use git add -p + named files for everything else.