The Complete Git & GitHub Roadmap
From Beginner to Advanced — The Ultimate Developer Playbook
1. What is Git vs GitHub?
A Version Control System (VCS) that lives on your local machine. It tracks changes in code, lets you go back to previous versions, and helps developers work together offline.
A cloud hosting platform explicitly for Git repositories. It is where you store, share, and collaborate on your local Git code online.
2. Core Concepts (Crucial)
- Repository (Repo): A project folder tracked by Git.
- Commit: A saved snapshot of your code.
- Branch: A parallel universe/version of your code.
- Merge: Combining two branches together.
- Clone: Copying an entire repo from GitHub to your PC.
- Pull / Push: Pull = GET changes. Push = SEND changes.
3. Installation & Setup
First, verify Git is installed:
First-time identity setup (Required):
git config --global user.email "your@email.com"
4. Basic Commands (Beginner)
Initialize a new local repo inside a folder:
Check current tracking status:
Add files to staging (ready to commit):
git add . // adds all changed files
Commit (Save) changes:
View commit history:
5. Connect to GitHub
After creating a blank repo on GitHub, link it locally:
git branch -M main
git push -u origin main
6. Branching & Merging (Intermediate)
// OR natively: git switch feature1
Merging a finished branch back into main:
git merge feature1
When 2 people edit the exact same line of code, Git gets confused and pauses the merge.
How to fix it:
- Open the conflicted file in VS Code
- Manually accept the correct code
- Run
git add .followed bygit commit
8. Undoing Mistakes (Important)
Undo a git add:
Undo a commit (but KEEP your file changes):
Undo a commit (and DESTROY the changes):
9. Advanced Workflow
git stash apply