Back to Home

The Complete Git & GitHub Roadmap

From Beginner to Advanced — The Ultimate Developer Playbook

1. What is Git vs GitHub?

Git

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.

GitHub

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:

git --version

First-time identity setup (Required):

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

4. Basic Commands (Beginner)

Initialize a new local repo inside a folder:

git init

Check current tracking status:

git status

Add files to staging (ready to commit):

git add file.txt
git add . // adds all changed files

Commit (Save) changes:

git commit -m "my first commit"

View commit history:

git log

5. Connect to GitHub

After creating a blank repo on GitHub, link it locally:

git remote add origin https://github.com/username/repo.git
git branch -M main
git push -u origin main

6. Branching & Merging (Intermediate)

Create a Branch
git branch feature1
Switch Branch
git checkout feature1
// OR natively: git switch feature1

Merging a finished branch back into main:

git checkout main
git merge feature1
7. Merge Conflicts

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 by git commit

8. Undoing Mistakes (Important)

Undo a git add:

git reset file.txt

Undo a commit (but KEEP your file changes):

git reset --soft HEAD~1

Undo a commit (and DESTROY the changes):

git reset --hard HEAD~1

9. Advanced Workflow

Stash (Save Temp Work)
git stash
git stash apply
Rebase (Clean History)
git rebase main
Cherry Pick
git cherry-pick commit_id

Master the Real Industry Workflow

1. git clone → 2. git checkout -b feature → 3. Code → 4. git add & commit → 5. git push → 6. Create PR on GitHub.

Want real hands-on projects, visual diagrams, or interview prep? Enroll in a NextStopCode Masterclass today.