Mastering Version Control
for Coders
A hands-on guide to Git and GitHub — from zero to professional workflow.
Introduction & Setup
10 min//Why Does This Matter?
Every professional software engineer uses version control daily. Not knowing Git means you can&pos;t collaborate on real projects, contribute to open-source, or even apply for most internships and jobs.
Without Git
project_final_v3_FINAL_USE_THIS.zip — Lost code. Broken features. No history.
With Git
Every change tracked. Instantly revert. Collaborate without conflicts.
Industry Standard
94% of developers use Git. GitHub has 100M+ users worldwide.
//Pre-Workshop Setup
Make sure everyone has the following before continuing:
- Git installed — run
git --versionin terminal - GitHub account — created at github.com
- VS Code — or any text editor open
- Terminal / Command Prompt — ready
What is Git?
30 min//The Simple Explanation
Git is a time machine for your code. It records snapshots of your project over time, so you can see what changed, when, and by whom — and go back to any point in history.
Git is local — it lives on your computer. GitHub is the cloud service where you store and share your Git repositories.
//Core Concepts You Must Know
Repository (Repo)
A folder tracked by Git. Contains your project files + hidden .git/ folder with all history.
Commit
A saved snapshot of your project at a point in time. Like pressing Save, but permanently recorded with a message.
Branch
A parallel version of your project. Work on features without breaking the main code. Merge when done.
Staging Area
A holding area between your edits and a commit. Choose exactly which files go into each snapshot.
Remote
A copy of your repo stored online (e.g. GitHub). Push your commits there to back up and share.
Clone
Downloading a remote repository to your local machine. Gets you all the code AND all history.
//The Git Lifecycle
//First-time Git Configuration
Run these once on any new machine to tell Git who you are:
Everyday Git Commands
40 min//Starting a Repository
git init at the root of your project, not inside a subfolder. Look for the .git hidden folder — if it's there, you're inside a repo.//Checking What's Happening
These are the two commands you'll use the most — run them constantly to know your current state.
//The Save Loop: Add → Commit
This is the core workflow you'll repeat hundreds of times a day as a developer.
"fix stuff", "asdf", "changes"Good:
"Add user authentication with JWT", "Fix null pointer in login handler"Rule: Start with a verb. Describe what and why, not how. Future-you will thank you.
//Ignoring Files with .gitignore
Never commit passwords, API keys, or node_modules. Create a .gitignore file in your repo root:
//Branching and Merging
Branches let you work on a feature in isolation. Main/master is production — never break it directly.
//Quick Reference — All Essential Commands
| Command | What it does | Frequency |
|---|---|---|
| git init | Initialize a new repository in current folder | setup |
| git status | Show current state — what's changed, staged, or untracked | daily |
| git add . | Stage all changed files for the next commit | daily |
| git commit -m "msg" | Save a snapshot with a descriptive message | daily |
| git log --oneline | Show compact commit history | daily |
| git diff | Show exact line-by-line changes not yet staged | useful |
| git checkout -b <name> | Create and switch to a new branch | daily |
| git checkout <branch> | Switch to an existing branch | daily |
| git merge <branch> | Merge another branch into current branch | useful |
| git clone <url> | Download a remote repository locally | team |
| git pull | Fetch and merge latest changes from remote | team |
| git push origin main | Upload local commits to GitHub (remote) | team |
| git stash | Temporarily save uncommitted work and clean working dir | useful |
Stretch, grab water, ask quick questions. Back at 3:20 PM sharp.
GitHub — Profile, Pages & Repos
35 min//What is GitHub?
GitHub is the world's largest platform for hosting Git repositories. Think of it as Google Drive for code — but with superpowers: collaboration tools, issue tracking, automated pipelines, and a built-in portfolio system.
When a company looks at your resume, the first thing many engineers check is your GitHub profile. It's your public portfolio.
//Repositories: Public vs Private
Public Repository
Anyone on the internet can view it. Great for portfolios, open-source, and sharing your work with recruiters.
Private Repository
Only you and invited collaborators can see it. Use for client work, personal projects, and anything confidential.
README.md
The landing page of every repo. Always write one — explain what the project is, how to run it, and what it does.
//Connecting Local Repo to GitHub
//The GitHub Profile README
A secret feature: create a repo named exactly your GitHub username. Add a README.md inside — it shows up on your GitHub profile page as a custom banner.
//GitHub Pages — Free Website Hosting
GitHub Pages lets you host a static website for free, directly from any repository. Your URL will be username.github.io/repo-name. Perfect for portfolios and project demos.
- Go to your repository → Settings → Pages
- Under "Source", select branch
main, folder/ (root) - Click Save
- Wait 1-2 minutes — your site is live!
username.github.io (exactly) and push an index.html there. This becomes your root portfolio site at https://username.github.io.index.html with your name and push it to a new GitHub repo. Enable Pages and share your live URL in the group chat.Collaboration Workflows
25 min//How Teams Actually Use GitHub
Real-world projects follow a standard workflow. Understanding this gets you ready to contribute to any team or open-source project on day one.
//Fork → Clone → PR Workflow
This is the standard workflow for contributing to projects you don't own (open-source or team repos):
//Pull Requests (PRs)
A PR is a request to merge your branch into someone else's branch. It opens a discussion thread where team members can review your code, leave comments, request changes, and finally approve and merge.
- Title: Describe what the PR does in one sentence
- Description: Why this change? What does it fix/add? Screenshots if UI changed
- Request Reviewers: Tag teammates who should review
- Link Issues: Use "Fixes #12" to auto-close related issues on merge
//Issues
Issues are GitHub's task tracker. Use them to report bugs, request features, or assign work to team members. Every serious open-source project runs on issues.
//Resolving Merge Conflicts
Conflicts happen when two people edit the same line. Git marks the conflict in the file — you resolve it manually:
git pull before starting new work. Use short-lived branches — merge often. Communicate with your team about who's working where.Recap & What's Next
10 min//Today You Learned
Git Fundamentals
init, status, add, commit, log, branch, merge — the core save loop.
GitHub Basics
Repos, profile README, GitHub Pages, pushing code to remote.
Team Workflow
Fork, clone, branch, PR — the industry-standard collaboration cycle.
//Your Homework (Do This Tonight)
- Create your GitHub profile README and push it live
- Create a new repo, add a simple HTML page, enable GitHub Pages
- Fork any public repo on GitHub and submit a small PR
- Commit something every day this week — build the habit
//What to Learn Next
- Git Rebase — cleaner alternative to merge for linear history
- GitHub Actions — automate testing and deployment (CI/CD)
- git stash — save WIP changes and switch context fast
- Protected Branches + Code Review — enterprise team practices
- Semantic Versioning + Tags — version your releases properly
learngitbranching.js.org — Interactive visual Git tutorial
github.com/skills — GitHub's own free hands-on courses
ohshitgit.com — When things go wrong
Want to deploy your projects for free and automate workflows?
GitHub Pages & Workflows Guide