From your very first git init to untangling complex rebases and recovering lost commits.
A comprehensive, practical, and beginner-to-advanced roadmap for mastering version control.
flowchart TD
Start([🚀 Start Here]) --> P1[🌱 Phase 1: Beginners<br/>• Architecture & 4 Zones<br/>• Init, Status, Add, Commit<br/>• .gitignore & Diff<br/>• Remote Setup & Push]
P1 --> P2[🌿 Phase 2: Intermediate<br/>• Branching & Switching<br/>• Fast-Forward vs 3-Way Merge<br/>• Merge Conflict Resolution<br/>• Stash Workflow<br/>• Pull Requests & GitHub Flow]
P2 --> P3[🌳 Phase 3: Advanced Mastery<br/>• Interactive Rebasing & Squashing<br/>• Cherry-Picking<br/>• Fixing Mistakes: Reset vs Revert<br/>• Time Travel with Reflog<br/>• Binary Search with Bisect<br/>• Detached HEAD & Aliases]
P3 --> CS[⚡ Ultimate Cheat Sheet & Emergency Triage<br/>• High-Density Command Reference<br/>• 🚨 Emergency Fix Matrix]
| Phase | Guide | Key Topics |
|---|---|---|
| 01 | 🌱 Phase 1: Beginners | Git architecture (4 zones), init, status, add, commit, .gitignore, diff, GitHub remotes |
| 02 | 🌿 Phase 2: Intermediate | Branching, merging strategies, resolving merge conflicts, stash, PR workflow, team collaboration |
| 03 | 🌳 Phase 3: Advanced | Rebasing, squash commits, cherry-pick, reflog recovery, bisect, detached HEAD, Git aliases |
| REF | ⚡ Ultimate Cheat Sheet | Full command index + 🚨 Git Emergency Room triage guide for quick rescue |
Before writing any code, you will need a free GitHub account, Git installed on your system, and secure authentication configured.
- Visit GitHub.com.
- Click Sign up in the top-right corner.
- Follow the prompts to enter your email, create a secure password, and select a username.
- Verify your email address.
🐧 Linux Distributions
- Arch Linux / Manjaro / EndeavourOS:
sudo pacman -S git
- Ubuntu / Debian / Linux Mint / Pop!_OS:
sudo apt update && sudo apt install git - Fedora / RHEL / Rocky Linux:
sudo dnf install git
- openSUSE:
sudo zypper install git
- Alpine Linux:
apk add git
- Gentoo:
emerge --ask dev-vcs/git
- Void Linux:
sudo xbps-install -Su git
- NixOS:
nix-env -iA nixpkgs.git
🪟 Windows
- Official Standalone Installer (Includes Git Bash): Download from git-scm.com/download/win
- Windows Package Manager (Winget):
winget install --id Git.Git -e --source winget
- Chocolatey:
choco install git
- Scoop:
scoop install git
🍏 macOS
- Homebrew (Recommended):
brew install git
- Xcode Command Line Tools:
xcode-select --install
- MacPorts:
sudo port install git
😈 BSD Systems
- FreeBSD:
pkg install git - OpenBSD:
pkg_add git - NetBSD:
pkgin install git
After installation, tell Git your name and email. These credentials will be attached to every commit you make:
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"Tip
Set Your Default Branch & Preferred Editor:
git config --global init.defaultBranch main
git config --global core.editor "code --wait" # For VS Code (or 'nano', 'vim')GitHub no longer accepts account passwords when pushing over HTTPS. The most secure and convenient method is using an SSH key.
Open your terminal and run:
ssh-keygen -t ed25519 -C "your.email@example.com"(Press Enter to accept the default file location and optionally provide a passphrase).
- Linux:
cat ~/.ssh/id_ed25519.pub(orxclip -sel clip < ~/.ssh/id_ed25519.pub) - macOS:
pbcopy < ~/.ssh/id_ed25519.pub - Windows (Git Bash):
cat ~/.ssh/id_ed25519.pub | clip
- Go to GitHub.com → Settings (top right profile icon) → SSH and GPG keys.
- Click New SSH key.
- Give it a descriptive Title (e.g.,
Arch-Laptop) and paste your key into the Key field. - Click Add SSH key.
ssh -T git@github.com
# Expected output: "Hi username! You've successfully authenticated..."You can read this tutorial directly on GitHub or clone this repository to practice locally:
git clone git@github.com:livelyfun/Git-Github_Tutorial.git
cd Git-Github_Tutorialgit clone https://github.com/livelyfun/Git-Github_Tutorial.git
cd Git-Github_Tutorialgh repo clone livelyfun/Git-Github_Tutorial
cd Git-Github_TutorialReady to begin? Jump straight into 🌱 Phase 1: Git & GitHub for Beginners!
Contributions make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingTrick) - Commit your Changes (
git commit -m "feat: add interactive rebase tips") - Push to the Branch (
git push origin feature/AmazingTrick) - Open a Pull Request
Maintained with ❤️ by livelyfun and contributors.