Git Cheat Sheet — Common Git Commands Quick Reference

Free git cheat sheet with the most common git commands. Search, copy, and learn git commands for branching, merging, committing, and undo — all in one place.

To find a git command, type a keyword such as reset, stash or amend in the search box of this git cheat sheet, then click Copy on the matching command block.

Last updated:

Git Cheat Sheet — Common Git Commands Quick Reference. Free git cheat sheet with the most common git commands. Search, copy, and learn git commands for branching, merging, committing, and undo — all in one place.

Our git cheat sheet gives you instant access to the most common git commands — no more Googling the same syntax. Search by topic or keyword and copy any command in one click.

Covers the full workflow: config, init, clone, commit, branch, merge, rebase, push, pull, reset, revert and stash.

Whether you're a beginner just learning version control or an experienced developer who needs a quick git commands reference, this free online cheat sheet has you covered. All content loads locally in your browser — no account, no upload.

Related tools: Git Branch Name Generator, Gitignore Generator, Crontab Generator. Bookmark our free git cheat sheet for instant access to the most common git commands. Search by keyword, copy any command with one click, and keep your workflow moving.

Covers configuration, commits, branching, merging, rebasing, pushing, stashing and undoing mistakes.

What's Included Global config: user name and email Repository setup: git init, git clone Committing and amending commits Branching and merging Remote management: push, pull, fetch Undoing changes: reset, revert, stash Related tools: Git Branch Name Generator , Gitignore Generator .

Frequently asked questions

How do I use this git cheat sheet?

Scroll the list or type a keyword such as commit, reset or clone into the Search commands box; only the matching commands, or whole sections whose title matches, stay visible. Each entry has a short description and a code block with a Copy button that puts the command on your clipboard.

Which git commands are covered?

Global user.name and user.email, git init and git clone, git commit -am and --amend, creating, switching and deleting branches, git merge and git rebase, git fetch, pull and push including --force-with-lease, git stash, undoing commits with git reset or git revert, and renaming master to main.

How do I undo my last git commit but keep the changes?

Run git reset HEAD~1. The commit is removed from the branch but its changes stay in your working directory, so you can edit and commit them again. Replace 1 with N to undo the N most recent commits.

What is the difference between git reset and git reset --hard?

git reset HEAD~1 moves the branch back one commit and keeps the changes as uncommitted edits. git reset HEAD~1 --hard also discards those changes from your files, so use it only when you are sure you no longer need them.

How do I change my last commit message?

Run git commit --amend to open your editor and rewrite the message of the most recent commit. To add forgotten changes without touching the message, stage them and run git commit --amend --no-edit. Avoid amending commits you have already pushed to a shared branch.

How do I reset my local branch to match the remote?

Run git fetch origin, then git reset --hard origin/branch-name, replacing branch-name with your branch. This discards local commits and uncommitted changes on that branch, so stash or back up anything you want to keep first.

How to use this online tool

Git Cheat Sheet — Common Git Commands Quick Reference is designed for fast browser workflows when you need to format, validate, convert, decode, encode, generate, or inspect data without opening a heavy desktop app. Start with the input field or visible options, review the result, then copy or download the output for the next step.

Private processing in your browser

Git Cheat Sheet — Common Git Commands Quick Reference keeps the normal processing step local in your browser. That is useful for code snippets, tokens, documents, configuration values, text samples, and other material that should not be sent to a remote service unless you explicitly choose to share it.

When this tool is useful

Use Git Cheat Sheet — Common Git Commands Quick Reference for repeatable developer tasks, technical documentation, QA checks, quick conversions, debugging, content cleanup, and internal team workflows. The page focuses on clear inputs, immediate feedback, and output that is easy to reuse in code, reports, tickets, emails, or notes.

Practical tips

Before copying the final result, check important details such as spacing, casing, filenames, encoding, token structure, line breaks, or output format. Small checks prevent mistakes when the result is reused in source code, API requests, documentation, spreadsheets, or shared files.