GitHub Version Control — Complete Developer Guide

This page covers everything you need to know about Git & GitHub — from your very first git init to advanced recovery commands. Every command includes a real example and explains when and why to use it.


🗺️ Roadmap: Beginner → Advanced

Stage Level What You Learn
Stage 1 🟢 Beginner Setup, init, clone, add, commit, push, pull
Stage 2 🟡 Intermediate Branching, merging, pull requests, stash
Stage 3 🟠 Advanced Rebase, cherry-pick, reset, revert, reflog
Stage 4 🔴 Expert CI/CD hooks, submodules, signing commits, bisect

🟢 Stage 1 — Beginner: Setup & Core Workflow

1.1 First-Time Git Setup

When to use: Only once after installing Git on your machine.

git config --global user.name "Amrendra Bahubali"
git config --global user.email "[email protected]"
git config --global core.editor "code --wait"   # sets VS Code as default editor
git config --list                                 # verify all settings

1.2 Initialize a Repository

When to use: Starting a brand-new project locally that has no Git history yet.

mkdir my-project
cd my-project
git init

This creates a hidden .git folder — your project is now a Git repo.

1.3 Clone an Existing Repository

When to use: When you want to download an existing GitHub repo to your machine.

git clone <https://github.com/Bahubali/my-project.git>
git clone <https://github.com/Bahubali/my-project.git> my-folder  # clone into custom folder name

1.4 Check Status

When to use: Before any commit, to see what's changed, staged, or untracked.

git status