Skip to content

tanmaypatil24/git-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 The Ultimate Git & GitHub Cheatsheet

Git Version GitHub Status

Welcome to the Ultimate Git & GitHub Cheatsheet! This repository is a clean, structured, highly professional reference designed for daily development usage, interview revision, and quick mastering of version control.

Whether you are a terminal beginner committing your first lines of code or a senior engineer orchestrating complex interactive rebases, multi-branch workflows, and CI/CD pipelines, this guide covers everything with zero fluff and maximum practicality.


🧭 Repository Navigation Map

The cheatsheet is divided into 30 structured, self-contained chapters covering the entire spectrum of version control.

📁 Phase 1: Git Foundations (The Basics)

Chapter Topic Key Commands
Chapter 01 🖥️ Terminal Basics ls, cd, pwd, mkdir, rm
Chapter 02 ⚙️ Initial Git Setup git config, user.name, core.editor
Chapter 03 🏗️ Creating Repositories git init, git clone, git status
Chapter 04 📥 The Staging Area git add, git restore --staged, git add -p
Chapter 05 ✍️ Committing Changes git commit -m, git commit --amend, git diff
Chapter 06 🔍 Searching & Logs git log, git grep, git blame, git reflog
Chapter 07 📦 Moving & Renaming git mv, git mv -f, rename tracking
Chapter 08 🌿 Branching & Tagging git switch, git switch -c, git tag
Chapter 09 🌐 Remotes & Publishing git remote add, git push, git fetch
Chapter 10 🔀 Merge vs. Rebase git merge, git rebase basics

📁 Phase 2: Undoing & Workspace Control

Chapter Topic Key Commands
Chapter 11 🔄 Reset vs. Revert git reset --hard, git revert, git clean
Chapter 12 🐙 GitHub Integration git push -u origin, origin/main tracking
Chapter 13 📥 Fetching vs. Pulling git pull --rebase, git fetch, force-with-lease
Chapter 14 🚫 Git Ignore Rules .gitignore formatting, pattern matching
Chapter 15 🎒 Workspace Stashing git stash, git stash pop, git stash -u

📁 Phase 3: Advanced Operations & Collaboration

Chapter Topic Key Commands
Chapter 16 🔑 SSH Keys & Aliases ssh-keygen, global .gitconfig alias scripts
Chapter 17 🍒 Cherry-Pick & Reflog git cherry-pick, deep Reflog recovery, detached HEAD
Chapter 18 🔨 History Rewriting git rebase -i, squash, fixup, reword, drop
Chapter 19 🏷️ Releases & SemVer git tag -a, Semantic Versioning, pushing tags
Chapter 20 🤝 Forking & PR Workflows upstream sync, pull requests, open-source setup

📁 Phase 4: Enterprise Git & DevOps

Chapter Topic Key Concepts
Chapter 21 💥 Conflict Resolution Marker parsing, git mergetool, Meld/VS Code setup
Chapter 22 📐 Git Flow vs. Trunk Git-Flow AVH, Trunk-Based Development, Monorepos
Chapter 23 🌳 Submodules & Worktrees git submodule, git worktree add for multitasking
Chapter 24 🪝 Git Hooks & Husky pre-commit, Husky, Commitlint integration
Chapter 25 🔬 Git Under the Hood Blobs, Trees, Commits, Refs, plumbing cat-file
Chapter 26 💾 Large File Storage (LFS) Git LFS config, .gitattributes line-endings
Chapter 27 🛡️ Security & Purging GPG Signatures, git-filter-repo history purging
Chapter 28 ⚙️ GitHub Actions CI/CD YAML test configuration, skip ci, status pipelines
Chapter 29 📋 Conventional Commits Standardize prefix structures, automated changelogs
Chapter 30 🗺️ Progressive Roadmap Beginner-to-Expert roadmap, visual tooling list

⚡ Quick Start: Most-Used Commands Reference

If you are in a rush, here are the most frequently used commands that every developer runs daily:

# 1. Start a new repository
git init

# 2. Check changes and status
git status

# 3. Diff staged changes
git diff --staged

# 4. Stage and commit changes (Conventional Commit style)
git add .
git commit -m "feat: implement payment validation"

# 5. Clean update from remote main using rebase (Linear history)
git pull --rebase origin main

# 6. Push features safely to origin branch
git push -u origin feature/login

🛠️ Suggested Practice Workflow

To get the most out of this cheatsheet, we suggest adopting this clean workflow for your daily project commits:

  [ Code ] ➔ [ git status ] ➔ [ git diff ] ➔ [ git add -p ]
                                                   │
  [ git push ] 🠔 [ git pull --rebase ] 🠔 [ git commit ]
  1. Audit modifications: Run git status and git diff before doing anything.
  2. Stage selectively: Use patch staging (git add -p) to review your code blocks line-by-line while staging.
  3. Draft commit: Write a structured commit using Conventional Commits style (git commit -m "feat: ...").
  4. Pull safely: Pull remote updates using rebase (git pull --rebase origin main).
  5. Publish: Push features using git push.

🔌 Bonus Productivity Tools (Extensions)

Enhance your GitHub browser experience with these highly recommended, developer-proven extensions:

  1. Octotree: Adds a full, interactive file tree sidebar on the left side of GitHub pages, allowing you to browse repositories without opening endless tabs.
  2. GitZip for GitHub: Enables double-clicking empty space next to folders/files to instantly download them individually as a .zip package.
  3. Refined GitHub: Adds over 200 UX improvements to the default GitHub interface, including gray whitespace dots, clickable issue links, and visual feedback avatars.

🤝 Contribution Guidelines

This cheatsheet is a community-first developer resource. Contributions are highly welcome!

  1. Fork the repository and create your custom feature branch:
    git switch -c feature/improved-git-hooks
  2. Make your edits following the standard Conventional Commits style.
  3. Keep descriptions highly technical, concise, and focused on real-world application.
  4. Open a Pull Request explaining what changes were introduced and why they improve the cheatsheet.

🎯 Master Mastery Roadmap

If you are looking to progressively master Git step-by-step, check out the comprehensive Progressive Git Mastery Roadmap containing visual interactive tools, the Pro Git Book guidelines, and VS Code productivity extensions.


Author: Tanmay Patil (GitHub: @tanmaypatil15)
Made with ❤️ for developers worldwide.

About

This repository is a clean, structured, highly professional reference designed for daily development usage, interview revision, and quick mastering of version control.

Topics

Resources

Stars

Watchers

Forks

Contributors