Git, GitHub, and the terminal
Version control and the command line, framed as safe habits rather than intimidating tools.
The mental model
Git records the history of a project on your computer. A repository is the project Git tracks. A commit is a named checkpoint. A branch is a parallel line of work. A merge combines changes.
GitHub stores repositories online and supports review and collaboration. You push local commits to the remote repository and pull remote changes to your machine. A pull request proposes merging one branch into another and creates a place for review.
The everyday Git loop
$ git switch main
$ git pull
$ git switch -c feature/recharge-flow
# work and review
$ git status
$ git add .
$ git commit -m "Build recharge question flow"
$ git push -u origin feature/recharge-flow
Then open a pull request, review, merge, return to main, and pull again.
For a solo learning project, you can work more simply. The principles still matter: check status, commit meaningful checkpoints, and push a backup before risky changes.
Terminal essentials
| Command | Meaning |
|---|---|
pwd | Show the folder you are currently in |
ls | List files and folders |
cd folder-name | Enter a folder |
cd .. | Move up one folder |
mkdir project-name | Create a folder |
code . | Open the current folder in VS Code, if configured |
npm install | Install the project’s listed packages |
npm run dev | Start the local development server |
npm run build | Create or verify a production build, if defined |
git status | Show changed files and current branch |
git diff | Show unstaged line-by-line changes |
| Ctrl + C | Stop a running terminal process |
Safe habits
- Run
pwdandlswhen you are unsure where you are. - Read destructive commands carefully.
rmdoes not normally use a recycle bin. - Do not use
sudobecause an error message told you to; understand why it is needed. - Ask the agent to explain a command before you approve it.
- Use
git statusbefore and after agent changes. - Commit before large experiments so you have a clear recovery point.
- Do not commit secrets, generated dependency folders, or local environment files.