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| 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