Skip to content

Repository files navigation

🚀 The Ultimate Git & GitHub Tutorial

Git GitHub License: MIT PRs Welcome

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.


🧭 Navigation & Learning Roadmap

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]
Loading

📚 Course Index

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

🛠️ Prerequisites & Setup

Before writing any code, you will need a free GitHub account, Git installed on your system, and secure authentication configured.

1. Create a GitHub Account

  1. Visit GitHub.com.
  2. Click Sign up in the top-right corner.
  3. Follow the prompts to enter your email, create a secure password, and select a username.
  4. Verify your email address.

2. Install Git on Your Operating System

🐧 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

3. Configure Git Identity

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')

4. Authenticate with GitHub (SSH Setup)

GitHub no longer accepts account passwords when pushing over HTTPS. The most secure and convenient method is using an SSH key.

Step A: Generate 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).

Step B: Copy Your Public Key

  • Linux: cat ~/.ssh/id_ed25519.pub (or xclip -sel clip < ~/.ssh/id_ed25519.pub)
  • macOS: pbcopy < ~/.ssh/id_ed25519.pub
  • Windows (Git Bash): cat ~/.ssh/id_ed25519.pub | clip

Step C: Add the Key to GitHub

  1. Go to GitHub.comSettings (top right profile icon) → SSH and GPG keys.
  2. Click New SSH key.
  3. Give it a descriptive Title (e.g., Arch-Laptop) and paste your key into the Key field.
  4. Click Add SSH key.

Step D: Test Connection

ssh -T git@github.com
# Expected output: "Hi username! You've successfully authenticated..."

💻 Clone & Practice Locally

You can read this tutorial directly on GitHub or clone this repository to practice locally:

Option 1: Using SSH (Recommended)

git clone git@github.com:livelyfun/Git-Github_Tutorial.git
cd Git-Github_Tutorial

Option 2: Using HTTPS

git clone https://github.com/livelyfun/Git-Github_Tutorial.git
cd Git-Github_Tutorial

Option 3: Using GitHub CLI (gh)

gh repo clone livelyfun/Git-Github_Tutorial
cd Git-Github_Tutorial

🚀 Get Started Now

Ready to begin? Jump straight into 🌱 Phase 1: Git & GitHub for Beginners!


🤝 Contributing

Contributions make the open-source community an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingTrick)
  3. Commit your Changes (git commit -m "feat: add interactive rebase tips")
  4. Push to the Branch (git push origin feature/AmazingTrick)
  5. Open a Pull Request

Happy Coding! 🎉
Maintained with ❤️ by livelyfun and contributors.

About

learn git and github from beginner to advance. All commands are listed.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors