Everything you need to go from zero to confident with Git & GitHub
Cheat sheets · Illustrated PDFs · Real-world scenarios · Basic → Advanced
Most Git tutorials either drown you in theory or show you 3 commands and call it a day.
This repo takes a scenario-first approach — real situations, exact commands, and explanations of why each one works.
Whether you're:
- 🆕 Pushing your first file to GitHub
- 🤝 Collaborating on a team project
- 🔥 Recovering from a bad
git reset - 🚀 Tagging releases and working with PRs
...this repo has you covered.
GitxGithub/
├── 📁 Git/
│ ├── 📄 Git_GitHub_101.pdf ← Basics: CLI, branching, forking, stash, rebase
│ ├── 📄 Git_Github Notes.pdf ← Workflow notes & command reference
│ ├── 📄 git-cheat-sheet-education.pdf ← Official GitHub cheat sheet
│ └── 📄 git_missing_topics(other than 101,notes,cheatsheet).pdf ←Other than the above 3 pdfs covers everything
├── 📁 Scenario-Based_Guide/
│ └── 📄 git_scenarios.pdf ← Loaded with Real Word Scenarios for better understanding
└── 📄 README.md ← You're here
- Basics of Git CLI
- init, clone, add, commit, push
- Branching, merging, PRs
📄 git_scenarios.pdf
Learn Git like a real developer:
- First-time setup
- Uploading code
- Branching & merging
- Fork & PR workflow
- Merge conflicts
- Undoing mistakes
- Team workflows
- Releases & tagging
- Advanced debugging
💡 Based on real-world developer situations
👉 This replaces traditional boring tutorials
📄 git_missing_topics.pdf
Covers what most tutorials don’t teach:
git reflog(recover anything)git cherry-pickgit bisect(debug faster)git blamegit commit --amend- GitHub CLI (
gh) - SSH & Authentication
- Advanced
.gitignore
- Quick command reference
- Perfect for revision
| # | Scenario | What You'll Learn |
|---|---|---|
| 01 | First-Time Setup | git config, SSH keys, no-password auth |
| 02 | Upload Your First File | clone → add → commit → push |
| 03 | Working with Branches | feature branches, merge, cleanup |
| 04 | Contributing via Fork | fork, upstream remote, pull requests |
| 05 | Handling Merge Conflicts | conflict markers, manual resolve |
| 06 | Undoing Mistakes | restore, reset, revert — matched to situation |
| 07 | Keeping Fork in Sync | fetch, rebase, reset --hard upstream |
| 08 | Team Feature Branch Workflow | squash commits, PR review, protect main |
| 09 | Tagging & Releasing Versions | annotated tags, GitHub Releases, semver |
| 10 | Cherry-pick & Bisect | apply one commit anywhere, binary-search bugs |
New to Git? Run these 4 commands. That's it.
# 1️⃣ One-time setup (first time on any machine)
git config --global user.name "YourName"
git config --global user.email "you@example.com"
# 2️⃣ Clone the repo once
git clone https://github.com/YourUsername/YourRepo.git
cd YourRepo
# 3️⃣ Stage → Commit → Push (repeat for every change)
git add path/to/YourFile.java
git commit -m "Add InsertLinkedList.java to LinkedList folder"
git push origin main🔥 If push is rejected (someone else pushed first):
git pull origin main --rebase git push origin main
# ── Daily workflow ────────────────────────────────────────────
git status # what's changed?
git add . # stage everything
git commit -m "feat: your msg" # commit
git push # push
# ── Branches ─────────────────────────────────────────────────
git checkout -b feature/my-thing # create + switch
git checkout main # go back to main
git merge feature/my-thing # merge in
# ── Oops recovery ────────────────────────────────────────────
git restore filename.txt # undo unsaved edits
git restore --staged filename.txt # unstage a file
git reset HEAD~1 --soft # undo last commit, keep changes
git revert abc1234 # safely undo a pushed commit
# ── Inspect ──────────────────────────────────────────────────
git log --oneline --graph --all # visual branch history
git diff # what changed (unstaged)
git blame filename.js # who wrote each line
git reflog # full history — recover anythingContributions are welcome! Found a missing scenario? A cleaner explanation?
# 1. Fork this repo (click Fork button above)
# 2. Clone your fork
git clone https://github.com/YOUR_USERNAME/GitxGithub.git
# 3. Create a branch
git checkout -b improve/scenario-name
# 4. Make your changes, commit
git add .
git commit -m "Add: scenario for GitHub Actions workflow"
# 5. Push and open a Pull Request
git push origin improve/scenario-nameThen open a Pull Request from your fork → this repo's main.
Good first contributions:
- 📝 Fix a typo or unclear explanation
- ➕ Add a missing command or scenario
- 🌍 Add examples for Windows (most examples use Mac/Linux)
- 🖼 Improve illustrations or diagrams in the PDFs
If this helped you, consider:
- ⭐ Starring the repo (top right of this page)
- 🍴 Forking it to build your own version
- 📢 Sharing in your dev community, discord, or college group
Every star helps more developers find this resource.
Made by Krish6115 — CS undergraduate, Full-Stack developer, competitive programmer & AI/ML Enthusiast.
Feel free to open an issue if something's unclear or missing.
⭐ Star · 🍴 Fork · 📢 Share
Built for developers who want to understand Git, not just memorize commands.