DEV Community

Ikegbo Ogochukwu
Ikegbo Ogochukwu

Posted on

COMPLETE COURSE: Git & GitHub (From Zero to Advanced)

📘 COURSE OVERVIEW

This course gives you a rock-solid foundation in:

  • Git (local version control)
  • GitHub (remote collaboration)
  • Real-world workflows (branching, merging, collaboration)

Git = tracks changes locally
GitHub = cloud platform for collaboration

🧩 MODULE 1: WHAT IS GIT?

🔹 Definition

Git is a Version Control System (VCS) that:

  • Tracks every change in your files
  • Stores history (who, when, what changed)
  • Allows rollback to previous versions

🔹 Key Features

  • Tracks any file type (code, text, images, videos)
  • Maintains multiple versions
  • Enables safe experimentation

🔹 Real-world Problem Git Solves

You:

  • Build a project → client likes it
  • Update it → client wants old version

👉 Without Git → you're stuck
👉 With Git → you restore instantly


🔗 MODULE 2: GIT vs GITHUB

🔹 Git

  • Local tool
  • Runs on your computer

🔹 GitHub

  • Cloud platform
  • Stores repositories online
  • Enables collaboration

🔹 Analogy

  • Git = coffee ☕
  • GitHub = coffee shop 🏪

🔹 Alternatives

  • GitLab
  • Bitbucket

🏗️ MODULE 3: GIT ARCHITECTURE

🔹 Two Parts

  1. Local
  2. Remote (GitHub)

🔹 Workflow Stages

  1. Working Directory
  • Where you edit files
  1. Staging Area
  • Temporary holding area
  1. Repository
  • Permanent storage (commit history)

🔁 Workflow Summary

Working Directory → Staging Area → Local Repo → Remote Repo
Enter fullscreen mode Exit fullscreen mode

⚙️ MODULE 4: INSTALLING GIT

🔹 Steps

  1. Go to official Git website
  2. Download for:
  • Windows (32/64-bit)
  • Mac (Homebrew)
  • Linux

🔹 Verify Installation

git --version
Enter fullscreen mode Exit fullscreen mode

✔ If installed → shows version
❌ Else → error


💻 MODULE 5: TERMINAL BASICS

🔹 Important Commands (NOT Git commands)

cd       # change directory
pwd      # show current path
mkdir    # create folder
touch    # create file
ls       # list files
Enter fullscreen mode Exit fullscreen mode

📁 MODULE 6: CREATING A PROJECT

🔹 Steps

cd Desktop
mkdir git-1
cd git-1

touch 1.txt
touch 2.txt

mkdir my-folder
cd my-folder
touch 3.txt
Enter fullscreen mode Exit fullscreen mode

🚀 MODULE 7: INITIALIZING GIT

🔹 Command

git init
Enter fullscreen mode Exit fullscreen mode

🔹 What Happens

  • Creates hidden .git folder
  • Git starts tracking project
ls -la
Enter fullscreen mode Exit fullscreen mode

👉 Shows .git folder


🌐 MODULE 8: GITHUB REPOSITORY

🔹 Steps

  1. Go to GitHub
  2. Create new repo
  3. Add files online
  4. Commit changes

📥 MODULE 9: CLONING A REPO

🔹 Command

git clone <repo-url>
Enter fullscreen mode Exit fullscreen mode

🔹 Result

  • Downloads remote repo
  • Creates local copy

🔍 MODULE 10: TRACKING CHANGES

🔹 Command

git status
Enter fullscreen mode Exit fullscreen mode

🔹 Shows:

  • Modified files
  • New files
  • Deleted files

📦 MODULE 11: STAGING (git add)

🔹 Purpose

Move changes → staging area


🔹 Variations

1. Add everything

git add --all
git add -A
Enter fullscreen mode Exit fullscreen mode

2. Add current directory

git add .
Enter fullscreen mode Exit fullscreen mode

3. Add specific file

git add file.txt
Enter fullscreen mode Exit fullscreen mode

4. Add by extension

git add *.txt
Enter fullscreen mode Exit fullscreen mode

5. Add using wildcard

git add *
Enter fullscreen mode Exit fullscreen mode

⚠️ Does NOT include deleted files


🔄 MODULE 12: UNSTAGING

🔹 Command

git reset
Enter fullscreen mode Exit fullscreen mode

👉 Moves files back to working directory


💾 MODULE 13: COMMITTING

🔹 Command

git commit -m "message"
Enter fullscreen mode Exit fullscreen mode

🔹 Meaning

  • Permanently saves changes

⚠️ First-time Setup

git config --global user.email "you@email.com"
git config --global user.name "Your Name"
Enter fullscreen mode Exit fullscreen mode

⏪ MODULE 14: UNDO COMMITS

git reset HEAD~
Enter fullscreen mode Exit fullscreen mode

👉 Undo last commit


❌ MODULE 15: DELETING FILES

🔹 Delete + stage

git rm file.txt
Enter fullscreen mode Exit fullscreen mode

🔹 Force delete

git rm -f file.txt
Enter fullscreen mode Exit fullscreen mode

🔹 Remove from Git only

git rm --cached file.txt
Enter fullscreen mode Exit fullscreen mode

📜 MODULE 16: VIEW HISTORY

git log
Enter fullscreen mode Exit fullscreen mode

Short version:

git log --oneline
Enter fullscreen mode Exit fullscreen mode

🌿 MODULE 17: BRANCHING

🔹 Create branch

git branch development
Enter fullscreen mode Exit fullscreen mode

🔹 View branches

git branch
Enter fullscreen mode Exit fullscreen mode

🔹 Switch branch

git checkout development
Enter fullscreen mode Exit fullscreen mode

🔹 Concept

  • Main = stable code
  • Branch = experimentation

🔀 MODULE 18: MERGING

🔹 Merge branch

git merge development
Enter fullscreen mode Exit fullscreen mode

⚠️ MODULE 19: MERGE CONFLICTS

Occurs when:

  • Same file edited in different branches

🔹 Resolution Steps

  1. Open file
  2. Choose correct version
  3. Remove conflict markers
  4. Commit

⏳ MODULE 20: TIME TRAVEL

🔹 Go to old commit

git checkout <commit-id>
Enter fullscreen mode Exit fullscreen mode

🔹 Return to latest

git checkout main
Enter fullscreen mode Exit fullscreen mode

🔍 MODULE 21: COMPARE CHANGES

git diff <commit1> <commit2>
Enter fullscreen mode Exit fullscreen mode
  • Red → removed
  • Green → added

☁️ MODULE 22: REMOTE OPERATIONS

🔹 Push

git push origin main
Enter fullscreen mode Exit fullscreen mode

🔹 Fetch

git fetch
Enter fullscreen mode Exit fullscreen mode

🔹 Pull

git pull
Enter fullscreen mode Exit fullscreen mode

🔁 Summary

  • push → local → remote
  • fetch → remote → local (no merge)
  • pull → fetch + merge

🔄 MODULE 23: RESTORE

🔹 Undo changes

git restore file.txt
Enter fullscreen mode Exit fullscreen mode

🔹 Restore all

git restore .
Enter fullscreen mode Exit fullscreen mode

🔹 Unstage

git restore --staged file.txt
Enter fullscreen mode Exit fullscreen mode

📦 MODULE 24: STASH

🔹 Save unfinished work

git stash
Enter fullscreen mode Exit fullscreen mode

🔹 Retrieve later

git stash apply
Enter fullscreen mode Exit fullscreen mode

🧠 FINAL SUMMARY

You now understand:

  • Git fundamentals
  • Local vs remote workflow
  • Full command lifecycle
  • Branching & collaboration
  • Conflict resolution
  • Undoing mistakes safely

Top comments (0)