COMPLETE DEVELOPER ROADMAP
Git & GitHub
■
Mastery Roadmap
Beginner → Intermediate → Advanced → Pro
BEGINNER INTERMEDIATE ADVANCED PRO
What is Git vs GitHub?
Git GitHub Why Both?
A free, open-source version control system A cloud platform that hosts Git repositories Git manages your version history locally.
that runs locally on your computer. It tracks online. It adds collaboration features: pull GitHub stores it remotely and makes
changes in your code over time and lets you requests, issues, actions, code review, and collaboration possible. Together they are the
go back to any previous version. team management. #1 developer toolset worldwide.
Initial Setup — Run These First!
Initial Git Configuration
$ git --version Check if Git is installed
$ git config --global [Link] "YourName" Set your name for all commits
$ git config --global [Link] "you@[Link]" Set your email
$ git config --global [Link] "code --wait" Set VS Code as default editor
$ git config --list View all your config settings
$ git config --global [Link] main Set default branch to main
Roadmap Overview
Level Topics Covered Time Estimate Goal
■ Beginner Init, add, commit, status, log, diff Week 1–2 Track your own code
■ Intermediate Branching, merging, remotes, pull requests Week 3–5 Collaborate with others
■ Advanced Rebase, cherry-pick, stash, hooks, blame Week 6–8 Pro workflows
■ Pro CI/CD, GitHub Actions, submodules, GPG, tags Week 9–12 Automate everything
Git & GitHub Mastery Roadmap · Beginner to Advanced Page 1 / 7
BEGINNER
LEVEL 01
Start here — the absolute basics
■
Git's 4 Areas — Understanding the Flow:
Working■Directory Staging■Area Local■Repo Remote■Repo
Repository Setup Tracking Files
$ git init Create a new local repo $ git status See what has changed
$ git init my-project Init repo in new folder $ git add [Link] Stage a specific file
$ git clone <url> Copy a remote repo locally $ git add . Stage ALL changed files
$ git clone <url> folder Clone into specific folder $ git add -p Interactively stage chunks
$ ls -la Check .git folder was created $ git rm --cached file Unstage a file
Making Commits Viewing History
$ git commit -m "feat: add login" Commit with a message $ git log Full commit history
$ git commit -am "fix: typo" Stage tracked files + commit $ git log --oneline Compact one-line history
$ git commit --amend Edit the last commit message $ git log --oneline --graph Visual branch graph
$ git commit --amend --no-edit Add changes to last commit $ git diff Show unstaged changes
$ git diff --staged Show staged changes
■ TIP Commit message format: type(scope): description → feat: add login page | fix: null pointer bug | docs: update README
■ WARNING Never use 'git add .' blindly! Always run 'git status' first to see what you're staging.
The .gitignore File — What NOT to Track
Create a .gitignore file in Common files to ignore: Useful commands:
root:
# Dependencies ✗ Passwords & API keys (.env) # Check if file is ignored
node_modules/ ✗ node_modules (auto-reinstallable) git check-ignore -v file
vendor/
✗ OS files (.DS_Store, [Link])
# Remove tracked file
✗ IDE files (.idea/, .vscode/)
# Environment files git rm --cached file
✗ Compiled/build outputs
.env
.[Link] ✗ Log files (*.log) # Global gitignore
✗ Uploaded user files git config --global
# Build outputs [Link] ~/.gitignore
dist/
build/
*.[Link]
Git & GitHub Mastery Roadmap · Beginner to Advanced Page 2 / 7
INTERMEDIATE
LEVEL 02
Build real workflows & collaboration skills
■
GitHub Collaboration Workflow:
main create■branch make■commits open■Pull Req code■review merge
Branching & Merging
Branch Commands Merging Branches
$ git branch List all local branches $ git checkout main Switch to target branch first
$ git branch -a List local + remote branches $ git merge feature/login Merge feature into main
$ git branch feature/login Create a new branch $ git merge --no-ff feature Merge with a merge commit
$ git checkout feature/login Switch to that branch $ git merge --squash feature Squash all commits into one
$ git checkout -b feature/login Create AND switch (shortcut!) $ git merge --abort Cancel a merge in progress
$ git switch -c feature/login Modern way to create + switch $ git log --merges See all merge commits
$ git branch -d feature/login Delete branch (after merge) $ git branch --merged Branches already merged
$ git branch -D feature/login Force delete branch
■ TIP Branch naming: feature/ for new features, fix/ for bug fixes, hotfix/ for urgent fixes, release/ for releases
Working with Remotes (GitHub)
Remote Setup & Push Fetch, Pull & Sync
$ git remote -v View remote connections $ git fetch origin Download changes (dont merge)
$ git remote add origin <url> Connect to GitHub repo $ git pull Fetch + merge remote into local
$ git push -u origin main First push + set upstream $ git pull --rebase Fetch + rebase (cleaner history)
$ git push Push to tracked remote branch $ git fetch --prune Remove stale remote branches
$ git push origin feature/login Push a specific branch $ git remote show origin Detailed remote info
$ git push --force-with-lease Safe force push (checks first) $ git pull origin main Pull from specific remote+branch
$ git remote rename origin upstream Rename a remote
Pull Request (PR) Workflow on GitHub
Step Action Where Why
1 Create feature branch Local terminal Keep main clean
2 Make commits on branch Local terminal Small focused changes
3 Push branch to GitHub git push origin branch Share your work
4 Open Pull Request GitHub website Request code review
5 Code Review & discussion GitHub website Catch issues early
Git & GitHub Mastery Roadmap · Beginner to Advanced Page 3 / 7
6 Fix review comments Local terminal Improve code quality
7 Merge PR into main GitHub website Ship the feature!
8 Delete feature branch GitHub website + local Clean up
■ NOTE Always pull latest main before creating a new branch: git checkout main && git pull
Git & GitHub Mastery Roadmap · Beginner to Advanced Page 4 / 7
ADVANCED
LEVEL 03
Power features & professional techniques
■
Git Rebase Stash — Save Work Temporarily
$ git rebase main Rebase current branch onto main $ git stash Stash all uncommitted changes
$ git rebase -i HEAD~3 Interactive rebase last 3 commits $ git stash push -m "wip login" Stash with a name
$ # pick / squash / reword / dropOptions in interactive rebase $ git stash list See all stashes
$ git rebase --continue Continue after resolving conflict $ git stash pop Apply latest stash + delete it
$ git rebase --abort Cancel rebase entirely $ git stash apply stash@{2} Apply specific stash (keep it)
$ git push --force-with-lease Push after rebase (required) $ git stash drop stash@{0} Delete a specific stash
$ git stash clear Delete ALL stashes
■ IMPORTANT Never rebase commits that have been pushed to a shared remote branch — it rewrites history and breaks others' work!
Cherry-Pick & Reset Blame, Bisect & Reflog
$ Apply single commit to this branch
git cherry-pick <commit-hash> $ git blame [Link] See who wrote each line
$ git cherry-pick A..B Apply a range of commits $ git blame -L 10,25 [Link] Blame specific line range
$ git cherry-pick --abort Cancel cherry-pick $ git bisect start Start binary search for a bug
$ git reset --soft HEAD~1 Undo commit, keep staged changes $ git bisect good <hash> Mark commit as working
$ git reset --mixed HEAD~1 Undo commit, keep unstaged $ git bisect bad Mark current as broken
$ git reset --hard HEAD~1 Undo commit + DELETE changes! $ git bisect reset End bisect session
$ git revert <commit-hash> Undo commit with new commit (safe) $ git reflog See ALL your recent actions
$ git reflog show HEAD@{5} Recover "lost" commits!
Resolving Merge Conflicts
When a conflict happens: Steps to resolve: VS Code conflict tools:
<<<<<<< HEAD 1. Run git status to find conflicts ✓ Accept Current Change
const msg = 'Hello'; 2. Open each conflicted file ✓ Accept Incoming Change
=======
3. Choose: keep HEAD, keep theirs, or edit ✓ Accept Both Changes
const msg = 'Hi there';
manually ✓ Compare Changes
>>>>>>> feature/greeting
4. Remove all <<< === >>> markers
5. git add . to mark resolved Tip: Use git mergetool
6. git commit to finish merge for a visual diff editor
■ PRO TIP Use 'git pull --rebase' instead of 'git pull' to keep your history linear and reduce merge conflicts.
Git & GitHub Mastery Roadmap · Beginner to Advanced Page 5 / 7
PRO
LEVEL 04
Expert-level: CI/CD, automation & team workflows
■
Tags & Releases Git Hooks (Automation)
$ git tag List all tags $ ls .git/hooks/ See available hook templates
$ git tag v1.0.0 Create lightweight tag $ # pre-commit Runs before every commit
$ git tag -a v1.0.0 -m "Release" Create annotated tag $ # commit-msg Validates commit message format
$ git push origin v1.0.0 Push a specific tag $ # pre-push Runs before pushing
$ git push origin --tags Push all tags $ # post-merge Runs after a merge
$ git tag -d v1.0.0 Delete local tag $ chmod +x .git/hooks/pre-commit Make hook executable
$ git push origin :refs/tags/v1 Delete remote tag $ npx husky install Use Husky for team-wide hooks
GitHub Actions — CI/CD Automation
Basic Workflow File: Key Concepts: Popular Use Cases:
# .github/workflows/[Link]
name: CI Pipeline Workflow → Automated process (.yml file) ✓ Run tests on every PR
Event → What triggers it (push, PR, schedule) ✓ Auto-deploy to server on merge
on:
Job → A set of steps that run together ✓ Check code style (ESLint/Prettier)
push:
Step → Individual task (run command / use ✓ Build Docker images
branches: [ main ]
action) ✓ Send Slack notifications
pull_request:
branches: [ main ] Runner → The virtual machine that runs it ✓ Auto-assign reviewers
Action → Reusable step from marketplace ✓ Publish npm packages
jobs: ✓ Run security scans
test: Common triggers:
runs-on: ubuntu-latest on: push | pull_request | schedule | Marketplace:
steps: workflow_dispatch [Link]/marketplace/actions
- uses: actions/checkout@v3
- name: Run tests
run: npm test
Submodules & Worktree SSH & Security
$ git submodule add <url> Add a repo inside your repo $ Generate SSH key pair
ssh-keygen -t ed25519 -C "you@[Link]"
$ git submodule update --init Initialize all submodules $ cat ~/.ssh/id_ed25519.pub Copy this to GitHub Settings
$ git submodule update --remote Update to latest submodule $ ssh -T git@[Link] Test SSH connection to GitHub
$ Multiple checkouts at once
git worktree add ../hotfix hotfix/v1 $ git config --global [Link] gpg Setup GPG signing
$ git worktree list See all worktrees $ git commit -S -m "signed!" Create a signed commit
$ git worktree remove ../hotfix Remove a worktree $ git log --show-signature Verify commit signatures
Git & GitHub Mastery Roadmap · Beginner to Advanced Page 6 / 7
Branching Strategies
Git Flow GitHub Flow Trunk-Based Dev
Best for: versioned software releases Best for: continuous deployment / web apps Best for: large teams, fast CI/CD
Branches: Branches: Concept:
• main — production code • main — always deployable Everyone commits to main (trunk)
• develop — integration branch • feature/* — everything else very frequently (1-2x per day)
• feature/* — new features
• release/* — release prep Process: Requires:
• hotfix/* — urgent fixes 1. Branch from main • Feature flags
2. Commit + push • Excellent test coverage
Tools: git flow init 3. Open PR • Fast CI pipeline
4. Review + merge • High team discipline
5. Deploy main
Useful Git Aliases — Speed Up Your Workflow
Add these to ~/.gitconfig [alias] section
$ git config --global [Link] status git st → shorter git status
$ git config --global [Link] checkout git co → shorter checkout
$ git config --global [Link] "log --oneline --graph --all" git lg → pretty log
$ git config --global [Link] "reset --soft HEAD~1" git undo → undo last commit
$ git config --global [Link] "stash push -m" git save msg → named stash
Best Practices — Do's and Don'ts
■ DO THIS ■ DON'T DO THIS
Commit small, focused changes Commit 500 changed files at once
Write clear commit messages (feat/fix/docs) Use messages like 'fixed stuff' or 'asdf'
Pull before you push Push without pulling — causes conflicts
Use branches for every feature/fix Commit everything directly to main
Review your diff before committing Blindly 'git add .' without checking
Use .gitignore for secrets & node_modules Commit .env files or passwords!!
Delete merged branches Keep hundreds of stale branches
Use PR reviews for team projects Self-merge PRs without review
You are now equipped to use Git & GitHub professionally. Start with the basics, practice daily commits, get comfortable
with branching, then explore advanced topics. The best way to learn Git is to use it on real projects every single day. Every
mistake you make in Git can be fixed — that is the beauty of version control!
Git & GitHub Mastery Roadmap · Beginner to Advanced Page 7 / 7