Git Command Cheatsheet
Searchable reference of common git commands with copy buttons.
Setup
git initCreate a new local repository
git clone <url>Clone a remote repository
git config --global user.name "Name"Set your global username
Basics
git statusShow working tree status
git add <file>Stage changes for commit
git add .Stage all changes
git commit -m "message"Commit staged changes
git commit --amendAmend the previous commit
git diffShow unstaged changes
git diff --stagedShow staged changes
History
git log --oneline --graphCompact commit graph history
git show <commit>Show details of a commit
git blame <file>Show who last changed each line
Branching
git branchList local branches
git branch <name>Create a new branch
git checkout -b <name>Create and switch to a new branch
git switch <name>Switch to an existing branch
git merge <branch>Merge a branch into the current one
git rebase <branch>Reapply commits on top of another base
git rebase -i HEAD~3Interactive rebase of last 3 commits
git branch -d <name>Delete a local branch
Remote
git pushPush commits to the remote
git push -u origin <branch>Push and set upstream tracking
git pullFetch and merge from the remote
git fetchDownload remote refs without merging
git remote -vList remotes with their URLs
Undo
git stashStash uncommitted changes
git stash popReapply the most recent stash
git reset --soft HEAD~1Undo last commit, keep changes staged
git reset --hard HEAD~1Undo last commit and discard changes
git revert <commit>Create a new commit that undoes a commit
git checkout -- <file>Discard local changes in a file
git clean -fdRemove untracked files and directories
Tags
git tag <name>Create a lightweight tag
git tag -a <name> -m "msg"Create an annotated tag
Advanced
git cherry-pick <commit>Apply a specific commit onto current branch
git bisect startStart binary search for a bad commit
git submodule update --initInitialize and update submodules
git reflogShow history of HEAD movements
git worktree add ../path <branch>Check out a branch into a new working directory
About the Git Command Cheatsheet
Browse and search a categorized list of common git commands — setup, basics, branching, remote, undo, tags, and advanced — with one-click copy for each command.
Examples
Undo last commit
undoOutput
git reset --soft HEAD~1Related tools
Regex Cheatsheet
Dev Utilities
Searchable regex syntax reference with examples and copy buttons.
.htaccess Redirect Generator
Dev Utilities
Generate Apache .htaccess redirect and rewrite rules.
Chmod Calculator
Dev Utilities
Unix permission calculator: checkboxes, octal, and symbolic.
Code Comment Stripper
Dev Utilities
Remove comments from JS, HTML, Python, or SQL source.
Code Diff Merger
Dev Utilities
Side-by-side line diff of two code snippets with stats.
Cron Expression Builder
Dev Utilities
Build cron expressions visually with a human-readable description.
Frequently asked questions
Version 1.0.0 · Updated 2026-08-06 · Runs entirely in your browser