Lesson 8
npm, Git & GitHub
Build a practical mental model for npm, git & github and use it in working JavaScript.
By the end, you will be able to…
- Explain npm, git & github in your own words
- Use npm, git & github in a small program
- Recognize and debug a common failure mode
Build the mental model
npm manages your project's dependencies and scripts; Git tracks every change as a commit; GitHub hosts that history and coordinates review through pull requests. Small, focused commits and branches make review and rollback dramatically easier.
Syntax and working example
Read the code from inputs to output. Predict what it prints, then run it and change one value.
Why this matters
This is the actual daily workflow of professional software teams — nobody edits shared production code without version control and review.
Real-world example
This very project's commit history and pull request workflow is the exact process being described here.
Common mistakes
- Committing directly to main instead of a feature branch
- Writing vague commit messages like 'fix stuff'
- Committing node_modules or secrets instead of relying on .gitignore and environment variables
Try it yourself
Challenge
Write a function that validates a commit message follows a 'type: description' convention.
Knowledge check
Why do professional teams work in feature branches instead of committing directly to main?
Summary
Use focused feature branches, clear commit messages, and pull requests — the standard professional Git workflow.