Git & GitHub: Version Control Step by Step
Why version control matters
Without Git, projects become folders named “final”, “final2” and “final-REALLY”. Git records every change as a snapshot called a commit, so you can see what changed, when, and return to any earlier state. GitHub hosts those snapshots online — backup, portfolio and teamwork in one place. Employers genuinely check GitHub profiles.
Step 1 — Setup (once only)
git --version
git config --global user.name "Your Name"
git config --global user.email "you@example.com"Step 2 — Your first repository
git init
git add .
git commit -m "My first commit"
git statusgit init starts tracking the folder. git add stages changes, git commit saves the snapshot with a message, and git status shows where things stand. Write commit messages that explain why: “Add marks calculator with grade function” beats “update”.
Step 3 — Push to GitHub
Create an empty repository on GitHub (no README), then connect and push:
git branch -M main
git remote add origin YOUR-REPO-URL
git push -u origin mainAfter this first push, the daily routine is just: change code → git add . → git commit -m "message" → git push.
Branches — experiment without fear
git checkout -b new-feature
# work, add, commit as usual
git checkout main
git merge new-featureA branch is a safe parallel copy. If the experiment fails, delete the branch and main is untouched — this is how professional teams try ideas.
Practice task (1 hour)
Put one existing practice project on GitHub today: initialise, make at least three honest commits (structure, main feature, styling), push, and add a README that says what the project does and what you learned. That README is what recruiters actually read.
Common mistakes to avoid
- Committing once at the very end — small, frequent commits tell your learning story
- Uploading passwords or API keys — once pushed, treat them as public forever
- Working for weeks without pushing — your laptop is not a backup
Init, add, commit, push — four verbs run your whole workflow. Start today: a small, honest GitHub history is some of the strongest proof a student can show.