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.

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