All Shortcuts

Git Shortcuts & Commands — Complete Cheat Sheet (5)

Complete Git commands cheat sheet covering basic operations, branching, merging, history, and advanced workflows. Essential reference for every developer using version control.

About Git

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.

💡 Pro Tips for Git Users

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.

Related Shortcut Pages

Docker npm / yarn AWS CLI PowerShell tmux GNU Screen

Search all Git shortcuts interactively

Interactive Shortcut Finder

All Git Shortcuts

Basic Commands

ShortcutActionDescription
git initInitialize repoInitialize a new Git repository.

Branches

ShortcutActionDescription
git branchList branchesList local branches.

History & Undo

ShortcutActionDescription
git logCommit historyShow commit history.
git log --onelineOne-line logShow commits in one-line format.
git diffShow diffShow unstaged changes.

Pro Tips

Frequently Asked Questions

How do I undo the last Git commit?

Use 'git reset --soft HEAD~1' to undo the commit but keep changes staged, or 'git reset --hard HEAD~1' to discard changes completely.

What is the difference between git fetch and git pull?

git fetch downloads changes from remote without merging. git pull does both fetch and merge in one step.

How do I create a new branch and switch to it?

Use 'git checkout -b branch-name' or the newer 'git switch -c branch-name' to create and switch in one command.

How do I resolve merge conflicts in Git?

Open the conflicted files, look for <<<< ==== >>>> markers, edit to resolve, then 'git add' the files and 'git commit'.

How do I stash changes in Git?

Use 'git stash' to temporarily save changes, then 'git stash pop' to restore them later.

Browse shortcuts for 230 platforms

Explore All