Complete Git commands cheat sheet covering basic operations, branching, merging, history, and advanced workflows. Essential reference for every developer using version control.
Git is a popular DevOps/CLI tool used by professionals worldwide. Learning keyboard shortcuts can dramatically speed up your workflow — studies show shortcut users save an average of 8 days per year compared to mouse-only users.
This page covers all 24 Git shortcuts across 3 categories: Basic Commands, Branches, History & Undo. Each shortcut includes a description to help you understand when and how to use it effectively.
Start with the essentials: Learn git init (Initialize repo) and git clone [URL] (Clone repo) first — these are the most commonly used.
Practice daily: Pick 2–3 new shortcuts each day and consciously use them instead of the mouse. Within a week, they become muscle memory.
Print this cheat sheet: Keep a reference nearby until shortcuts become automatic. Focus on the Basic Commands category first.
CLI tip: Create shell aliases for the commands you use most. Combine them with these shortcuts for maximum efficiency.
Search all Git shortcuts interactively
Interactive Shortcut Finder| Shortcut | Action | Description |
|---|---|---|
| git init | Initialize repo | Initialize a new Git repository. |
| Shortcut | Action | Description |
|---|---|---|
| git branch | List branches | List local branches. |
| Shortcut | Action | Description |
|---|---|---|
| git log | Commit history | Show commit history. |
| git log --oneline | One-line log | Show commits in one-line format. |
| git diff | Show diff | Show unstaged changes. |
Use 'git reset --soft HEAD~1' to undo the commit but keep changes staged, or 'git reset --hard HEAD~1' to discard changes completely.
git fetch downloads changes from remote without merging. git pull does both fetch and merge in one step.
Use 'git checkout -b branch-name' or the newer 'git switch -c branch-name' to create and switch in one command.
Open the conflicted files, look for <<<< ==== >>>> markers, edit to resolve, then 'git add' the files and 'git commit'.
Use 'git stash' to temporarily save changes, then 'git stash pop' to restore them later.
Browse shortcuts for 230 platforms
Explore All