Sitemap

GitHub Learning Roadmap: From Zero to Hero

12 min readJan 11, 2026

--

Whether you’re a complete beginner who’s never touched a terminal or an intermediate developer looking to level up your collaboration skills, this roadmap will take you from zero to GitHub hero. I’ve structured this guide based on years of teaching developers and watching them transform from Git-anxious beginners to confident contributors.

Let’s dive in.

Press enter or click to view image in full size

The Complete Roadmap Overview

Phase 1: Foundation (Week 1-2)
↓
Phase 2: Core Git Skills (Week 3-4)
↓
Phase 3: GitHub Collaboration (Week 5-6)
↓
Phase 4: Advanced Workflows (Week 7-8)
↓
Phase 5: DevOps & Automation (Week 9-10)
↓
Phase 6: Mastery & Best Practices (Ongoing)

Phase 1: Foundation — Understanding the Basics

What is Git vs GitHub?

Before we write a single command, let’s clear up the most common confusion.

Git is a version control system — software that tracks changes in your files. Think of it as an “unlimited undo” button for your entire project.

GitHub is a cloud platform that hosts Git repositories and adds collaboration features like pull requests, issues, and project boards.

Analogy: Git is like Microsoft Word’s “Track Changes” feature. GitHub is like Google Docs — it lets you store your documents online and collaborate with others.

Setting Up Your Environment

Step 1: Install Git

# macOS (using Homebrew)
brew install git

# Ubuntu/Debian
sudo apt-get update
sudo apt-get install git
# Windows
# Download from https://git-scm.com/download/win

Step 2: Configure Git

# Set your identity (required for commits)
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

# Set default branch name
git config --global init.defaultBranch main
# Enable helpful colorization
git config --global color.ui auto
# Verify your configuration
git config --list

Step 3: Create a GitHub Account

  1. Go to github.com
  2. Sign up with your email
  3. Choose a memorable username (this becomes your brand!)
  4. Verify your email address

Step 4: Set Up SSH Authentication

# Generate SSH key
ssh-keygen -t ed25519 -C "your.email@example.com"

# Start SSH agent
eval "$(ssh-agent -s)"
# Add your key
ssh-add ~/.ssh/id_ed25519
# Copy your public key
cat ~/.ssh/id_ed25519.pub
# Copy the output and add it to GitHub → Settings → SSH Keys

Phase 1 Checkpoint

By the end of this phase, you should be able to:

  • [ ] Explain the difference between Git and GitHub
  • [ ] Have Git installed and configured
  • [ ] Have a GitHub account with SSH set up
  • [ ] Successfully run ssh -T git@github.com and see a welcome message

Phase 2: Core Git Skills — The Essential Commands

The Git Workflow Explained

Working Directory → Staging Area → Local Repository → Remote Repository
(edit) (git add) (git commit) (git push)

Your First Repository

Option A: Start from scratch locally

# Create a new directory
mkdir my-first-project
cd my-first-project

# Initialize Git
git init
# Create a file
echo "# My First Project" > README.md
# Check status (you'll use this constantly!)
git status
# Stage the file
git add README.md
# Commit with a message
git commit -m "Initial commit: Add README"

Option B: Clone an existing repository

# Clone a repository
git clone git@github.com:username/repository.git

# Navigate into it
cd repository

Essential Commands You’ll Use Daily

# Check what's changed
git status

# See detailed changes
git diff
# Stage specific files
git add filename.txt
# Stage all changes
git add .
# Commit staged changes
git commit -m "Descriptive message here"
# View commit history
git log
# View condensed history
git log --oneline
# Push to remote
git push origin main
# Pull latest changes
git pull origin main

Understanding the Staging Area

The staging area is Git’s “preparation zone.” It lets you craft exactly what goes into each commit.

# Example: You've modified 3 files but only want to commit 2

git status
# Shows: file1.txt, file2.txt, file3.txt (modified)
git add file1.txt file2.txt
git commit -m "Fix: Update configuration files"
# file3.txt remains uncommitted for a separate commit
git add file3.txt
git commit -m "Feature: Add new helper function"

Writing Good Commit Messages

The Formula:

<type>: <short description>
[optional body with more details]
[optional footer with references]

Types:

  • feat: — New feature
  • fix: — Bug fix
  • docs: — Documentation changes
  • style: — Formatting, missing semicolons, etc.
  • refactor: — Code restructuring without changing behavior
  • test: — Adding or updating tests
  • chore: — Maintenance tasks

Examples:

# Good ✅
git commit -m "feat: Add user authentication with JWT"
git commit -m "fix: Resolve null pointer exception in payment module"
git commit -m "docs: Update API documentation for v2 endpoints"

# Bad ❌
git commit -m "fixed stuff"
git commit -m "updates"
git commit -m "WIP"

Phase 2 Checkpoint

By the end of this phase, you should be able to:

  • [ ] Create a repository from scratch
  • [ ] Clone existing repositories
  • [ ] Stage and commit changes with meaningful messages
  • [ ] Push and pull from GitHub
  • [ ] Read and understand git log output

Phase 3: GitHub Collaboration — Working With Others

Branching Strategy

Branches let you work on features without affecting the main codebase.

# See all branches
git branch

# Create a new branch
git branch feature/user-login
# Switch to the branch
git checkout feature/user-login
# Or create and switch in one command
git checkout -b feature/user-login
# Modern alternative (Git 2.23+)
git switch -c feature/user-login

Visual representation:

main:     A---B---C---D---E
\
feature: F---G---H

Common Branching Naming Conventions

feature/description    → feature/add-shopping-cart
bugfix/description → bugfix/fix-login-error
hotfix/description → hotfix/critical-security-patch
release/version → release/v2.0.0
docs/description → docs/update-readme

Creating Your First Pull Request

Step 1: Push your branch

git push origin feature/user-login

Step 2: Create the PR on GitHub

  1. Go to your repository on GitHub
  2. Click “Compare & pull request” (appears after pushing)
  3. Fill in the PR template:
## Description
Brief description of what this PR does.

## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## How Has This Been Tested?
Describe the tests you ran.
## Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review
- [ ] I have commented my code where necessary
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings

Code Review Best Practices

As a Reviewer:

  • Be constructive and kind
  • Explain the why behind the suggestions
  • Use GitHub’s suggestion feature for small fixes
  • Approve when ready, request changes when needed

As an Author:

  • Respond to all comments
  • Don’t take feedback personally
  • Push updates and re-request review

Handling Merge Conflicts

Conflicts happen when two branches modify the same lines.

# Attempting to merge
git merge feature/user-login

# Git shows conflict markers in files:
<<<<<<< HEAD
current version of the code
=======
incoming version of the code
>>>>>>> feature/user-login

Resolution steps:

# 1. Open the conflicted file
# 2. Choose which code to keep (or combine both)
# 3. Remove the conflict markers
# 4. Stage the resolved file
git add resolved-file.txt

# 5. Complete the merge
git commit -m "Merge: Resolve conflicts in user module"

Forking and Contributing to Open Source

# 1. Fork the repository on GitHub (click "Fork" button)

# 2. Clone YOUR fork
git clone git@github.com:YOUR-USERNAME/repository.git
# 3. Add the original as "upstream"
git remote add upstream git@github.com:ORIGINAL-OWNER/repository.git
# 4. Keep your fork updated
git fetch upstream
git checkout main
git merge upstream/main
# 5. Create a branch, make changes, push to YOUR fork
git checkout -b fix/typo-in-readme
# make changes...
git push origin fix/typo-in-readme
# 6. Create PR from your fork to the original repository

Phase 3 Checkpoint

By the end of this phase, you should be able to:

  • [ ] Create and switch between branches
  • [ ] Push branches and create pull requests
  • [ ] Review others’ code on GitHub
  • [ ] Resolve merge conflicts
  • [ ] Fork repositories and contribute to open source

Phase 4: Advanced Workflows — Level Up Your Skills

Git Rebase vs Merge

Merge creates a merge commit preserving history:

main:     A---B---C-------M
\ /
feature: D---E

Rebase replays commits on top of the base branch:

Before:   A---B---C     (main)
\
D---E (feature)
After:    A---B---C---D'---E'   (feature rebased on main)
# Rebase your feature branch onto main
git checkout feature/user-login
git rebase main

# Interactive rebase (powerful!)
git rebase -i HEAD~3 # Rebase last 3 commits

Interactive rebase options:

  • pick — Keep the commit
  • reword — Change commit message
  • squash — Combine with previous commit
  • drop — Remove the commit

Stashing Changes

Temporarily save uncommitted work:

# Stash current changes
git stash

# Stash with a description
git stash save "WIP: halfway through login feature"
# List stashes
git stash list
# Apply most recent stash (keeps it in stash list)
git stash apply
# Apply and remove from stash list
git stash pop
# Apply a specific stash
git stash apply stash@{2}
# Delete all stashes
git stash clear

Cherry-Picking Commits

Apply specific commits to another branch:

# Get the commit hash
git log --oneline

# Cherry-pick to current branch
git cherry-pick abc1234
# Cherry-pick multiple commits
git cherry-pick abc1234 def5678

Git Bisect — Finding Bugs

Binary search through commits to find when a bug was introduced:

# Start bisect
git bisect start

# Mark current commit as bad
git bisect bad
# Mark a known good commit
git bisect good abc1234
# Git checks out a commit in the middle
# Test it, then mark:
git bisect good # if working
git bisect bad # if broken
# Repeat until Git finds the culprit
# When done:
git bisect reset

Undoing Mistakes

# Undo last commit but keep changes staged
git reset --soft HEAD~1
# Undo last commit and unstage changes
git reset HEAD~1
# Completely undo last commit (DESTRUCTIVE)
git reset --hard HEAD~1
# Create a new commit that undoes a previous commit (safe)
git revert abc1234
# Discard changes to a specific file
git checkout -- filename.txt
# Restore a deleted file from a previous commit
git checkout abc1234 -- deleted-file.txt

Git Tags for Releases

# Create a lightweight tag
git tag v1.0.0
# Create an annotated tag (recommended)
git tag -a v1.0.0 -m "Release version 1.0.0"
# Tag a specific commit
git tag -a v0.9.0 abc1234
# List tags
git tag
# Push tags to remote
git push origin v1.0.0
# Push all tags
git push origin --tags

Phase 4 Checkpoint

By the end of this phase, you should be able to:

  • [ ] Understand when to use rebase vs merge
  • [ ] Use interactive rebase to clean up commits
  • [ ] Stash and retrieve work in progress
  • [ ] Cherry-pick specific commits
  • [ ] Use git bisect to find bugs
  • [ ] Undo mistakes with reset and revert
  • [ ] Create and manage release tags

Phase 5: DevOps & Automation — GitHub Actions

Introduction to GitHub Actions

GitHub Actions automates workflows triggered by events (push, PR, schedule, etc.).

Get Vidhi Jayeswal’s stories in your inbox

Join Medium for free to get updates from this writer.

Key Concepts:

  • Workflow — Automated process defined in YAML
  • Job — Set of steps that execute on the same runner
  • Step — Individual task (run command or action)
  • Action — Reusable unit of code
  • Runner — Server that runs the workflows

Your First Workflow

Create .github/workflows/ci.yml:

name: CI Pipeline

# When to run
on:
push:
branches: [main]
pull_request:
branches: [main]
# What to run
jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
# Checkout code
- name: Checkout repository
uses: actions/checkout@v4

# Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

# Install dependencies
- name: Install dependencies
run: npm ci

# Run linting
- name: Run linter
run: npm run lint

# Run tests
- name: Run tests
run: npm test

# Build
- name: Build application
run: npm run build

Multi-Job Workflows with Dependencies

name: Complete CI/CD Pipeline

on:
push:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: npm test

build:
needs: test # Only runs if 'test' succeeds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build application
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-output
path: dist/

deploy:
needs: build # Only runs if 'build' succeeds
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' # Only on main branch
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: build-output
- name: Deploy to production
run: echo "Deploying to production..."

Using Secrets and Environment Variables

jobs:
deploy:
runs-on: ubuntu-latest
env:
NODE_ENV: production
steps:
- name: Deploy with secrets
env:
API_KEY: ${{ secrets.API_KEY }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: |
echo "Deploying with API key..."
./deploy.sh

Adding secrets:

  1. Go to repository Settings
  2. Navigate to Secrets and variables → Actions
  3. Click “New repository secret”

Matrix Builds (Test Across Versions)

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm test

Automated Releases with Semantic Versioning

name: Release

on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build
run: npm run build

- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Branch Protection Rules

Protect your main branch in Settings → Branches → Add rule:

Branch name pattern: main

☑ Require a pull request before merging
☑ Require approvals (1 or more)
☑ Dismiss stale pull request approvals

☑ Require status checks to pass before merging
☑ Require branches to be up to date
→ Select required checks: "test", "build"
☑ Require conversation resolution before merging
☑ Do not allow bypassing the above settings

Phase 5 Checkpoint

By the end of this phase, you should be able to:

  • [ ] Create GitHub Actions workflows
  • [ ] Set up CI pipelines for testing and building
  • [ ] Use secrets and environment variables
  • [ ] Implement matrix builds
  • [ ] Create automated releases
  • [ ] Configure branch protection rules

Phase 6: Mastery & Best Practices

Git Aliases for Productivity

Add to your ~/.gitconfig:

[alias]
# Short commands
co = checkout
br = branch
ci = commit
st = status

# Useful combos
unstage = reset HEAD --
last = log -1 HEAD
visual = log --oneline --graph --all

# Amend last commit
amend = commit --amend --no-edit

# Pretty log
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

# List branches by last modified
recent = for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)'

# Cleanup merged branches
cleanup = "!git branch --merged | grep -v '\\*\\|main\\|master' | xargs -n 1 git branch -d"

Repository Organization Best Practices

my-project/
├── .github/
│ ├── workflows/ # GitHub Actions
│ ├── ISSUE_TEMPLATE/ # Issue templates
│ ├── PULL_REQUEST_TEMPLATE.md
│ └── CODEOWNERS # Automatic reviewers
├── docs/ # Documentation
├── src/ # Source code
├── tests/ # Test files
├── .gitignore # Files to ignore
├── .gitattributes # Git attributes
├── README.md # Project overview
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE # License file
└── CHANGELOG.md # Version history

The CODEOWNERS File

Automatically request reviews from specific people:

# .github/CODEOWNERS

# Default owners for everything
* @username @team-leads
# Frontend team owns these
/src/frontend/ @frontend-team
# DevOps owns CI/CD
/.github/ @devops-team
/docker/ @devops-team
# Docs team
/docs/ @tech-writers
*.md @tech-writers

Git Hooks for Quality

Create .git/hooks/pre-commit (or use Husky):

#!/bin/sh

# Run linting
npm run lint
if [ $? -ne 0 ]; then
echo "Linting failed. Commit aborted."
exit 1
fi
# Run tests
npm test
if [ $? -ne 0 ]; then
echo "Tests failed. Commit aborted."
exit 1
fi
echo "All checks passed!"
exit 0

GitHub Features to Explore

GitHub Projects — Kanban boards for project management

GitHub Discussions — Community Q&A and announcements

GitHub Pages — Free hosting for static sites

GitHub Packages — Host your own packages (npm, Docker, etc.)

GitHub Codespaces — Cloud development environments

GitHub Copilot — AI pair programming

Learning Resources

Official Documentation

Interactive Learning

Books

  • Pro Git by Scott Chacon (free online)
  • Git Pocket Guide by Richard Silverman

Final Challenge: Build Your Portfolio

Now that you’ve reached hero status, demonstrate your skills:

  1. Create a professional GitHub profile with a profile README
  2. Contribute to 3 open-source projects (even documentation fixes count!)
  3. Build a project with proper Git workflow — branches, PRs, Actions
  4. Set up a complete CI/CD pipeline for a personal project
  5. Mentor someone else — teaching solidifies learning

Cheat Sheet: Commands at a Glance

# SETUP
git config --global user.name "Name"
git config --global user.email "email"
# BASICS
git init # Initialize repo
git clone <url> # Clone repo
git status # Check status
git add <file> # Stage file
git commit -m "message" # Commit
# BRANCHES
git branch <name> # Create branch
git checkout <name> # Switch branch
git checkout -b <name> # Create & switch
git merge <branch> # Merge branch
git branch -d <name> # Delete branch
# REMOTE
git remote add origin <url> # Add remote
git push origin <branch> # Push
git pull origin <branch> # Pull
git fetch # Fetch updates
# HISTORY
git log # View history
git log --oneline # Compact history
git diff # View changes
# UNDO
git reset --soft HEAD~1 # Undo commit, keep staged
git reset HEAD~1 # Undo commit, unstage
git revert <commit> # Create undo commit
git stash # Stash changes
Press enter or click to view image in full size

Conclusion

Mastering GitHub isn’t about memorizing commands — it’s about understanding the workflow and practicing consistently. Start with the basics, contribute to projects, break things, fix them, and keep learning.

The best Git users aren’t the ones who know every command; they’re the ones who collaborate effectively and aren’t afraid to ask for help.

Now go forth and commit!

--

--

Vidhi Jayeswal
Vidhi Jayeswal

Written by Vidhi Jayeswal

DevOps Engineer bridging the gap between Middleware and Modern Cloud.