Git Cheatsheet Interactive
Search and filter 50+ essential Git commands. Click any command to copy it instantly. Organized by category: setup, staging, branches, remotes, history, and more. Free, no sign-up.
git config --global user.name "Name"Set global usernamegit config --global user.email "[email protected]"Set global emailgit config --listShow all config settingsgit initInitialize a new repo in current directorygit clone <url>Clone a remote repositorygit statusShow working tree statusgit add <file>Stage a specific filegit add .Stage all changesgit add -pInteractively stage hunksgit commit -m "message"Commit with a messagegit commit --amendAmend the last commitgit diffShow unstaged changesgit diff --stagedShow staged changesgit stashStash current changesgit stash popApply stashed changesgit stash listList all stashesgit branchList local branchesgit branch -aList all branches (local + remote)git branch <name>Create a new branchgit checkout <branch>Switch to a branchgit checkout -b <branch>Create and switch to branchgit switch <branch>Switch branches (modern syntax)git switch -c <branch>Create and switch (modern syntax)git branch -d <branch>Delete a merged branchgit branch -D <branch>Force delete a branchgit merge <branch>Merge a branch into currentgit rebase <branch>Rebase onto another branchgit rebase -i HEAD~3Interactive rebase (last 3 commits)git remote -vList remote connectionsgit remote add origin <url>Add a remote named origingit fetchFetch all remotesgit fetch originFetch from origingit pullFetch and merge from remotegit pull --rebaseFetch and rebase from remotegit push origin <branch>Push branch to remotegit push -u origin <branch>Push and set upstreamgit push --force-with-leaseSafe force pushgit logShow commit historygit log --onelineCompact one-line loggit log --oneline --graphVisual branch graphgit log -pShow patches in loggit show <commit>Show a commit detailsgit blame <file>Show who changed each linegit log --author="Name"Filter log by authorgit log --since="2 weeks ago"Filter log by dategit restore <file>Discard working dir changesgit restore --staged <file>Unstage a filegit reset HEAD~1Undo last commit (keep changes)git reset --hard HEAD~1Undo last commit (discard changes)git revert <commit>Create a revert commitgit clean -fdRemove untracked files/dirsgit tagList all tagsgit tag v1.0.0Create lightweight taggit tag -a v1.0.0 -m "Release"Create annotated taggit push origin --tagsPush all tags to remotegit tag -d v1.0.0Delete a local tagFrequently Asked Questions
What is the difference between git fetch and git pull?▼
git fetch downloads changes from the remote but does NOT merge them into your working branch. git pull is essentially git fetch + git merge — it downloads and integrates remote changes. Use fetch when you want to review changes before merging.
How do I undo the last commit without losing changes?▼
Use 'git reset HEAD~1'. This moves the branch pointer back one commit but keeps your files unchanged (staged changes become unstaged). To also unstage, use 'git reset HEAD~1 --mixed'. To discard changes entirely, use 'git reset --hard HEAD~1'.
What is git stash used for?▼
git stash temporarily saves your uncommitted changes so you can work on something else. Use 'git stash' to save and 'git stash pop' to restore. This is useful when you need to switch branches mid-task without committing unfinished work.
What is the difference between git merge and git rebase?▼
git merge creates a new 'merge commit' that joins two branches while preserving history. git rebase rewrites history by moving your commits on top of another branch, creating a linear history. Rebase is cleaner but rewrites commits — never rebase shared/public branches.
Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →Premium Workflow Pack
Production-grade workflows, architecture guides, and deployment scripts for teams that ship. 10 advanced CI/CD workflows (blue-green, canary, E2E, security), 5 architecture deep-dives, code review checklist, PR process guide, and 5 battle-tested Bash deployment scripts.
Buy on Gumroad →You Might Also Need
Git Stash Manager
Visual reference for git stash commands. Copy-ready stash push, pop, apply, drop, list, and branch commands with stash index control. Free git stash cheat sheet.
Open free tool →
GitHub Actions Workflow Generator
Generate GitHub Actions YAML workflows instantly. Choose triggers (push, PR, schedule), runtime (Node.js, Python, Go, Rust), and jobs (test, lint, build, Docker, GitHub Pages). Copy-ready .github/work
Open free tool →
GitHub Actions YAML Linter
Lint your GitHub Actions workflow YAML before pushing. Catches broken needs references, invalid trigger events, hardcoded secrets, unversioned action pins, and YAML syntax errors. Free browser tool.
Open free tool →
More Free Tools
Related Articles
Git Branching Strategies Compared 2026: GitFlow vs Trunk-Based vs GitHub Flow
Compare the top Git branching strategies for 2026 — GitFlow, GitHub Flow, Trunk-Based Development, and GitLab Flow. Choose the right workflow for your team's size, release cadence, and CI/CD setup.
Git Workflow Best Practices 2025: Team-Proven Strategies
Git workflow best practices for 2025: branching strategies, commit conventions, PR reviews, rebasing vs merging, and CI/CD integration that teams actually use.
Aider AI: The Ultimate Terminal-Based AI Coding Assistant for 2026
Complete guide to Aider AI coding assistant. Setup, best practices, model options, and how this terminal-based tool compares to GUI editors for serious developer workflows.
Tmux Tutorial: The Complete Developer Workflow Guide (2026)
Learn tmux from scratch — sessions, windows, panes, scripts, and a complete developer workflow. Covers tmux 3.x with configuration examples, copy-mode navigation, and pair programming setups.
Git Merge vs Rebase: When to Use Each
Git merge vs rebase — understand the real difference, when each strategy makes sense, and which one to choose for your team's workflow. Includes practical examples and common mistakes to avoid.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →