Git Cheatsheet - Quick Git Command Reference
Quick reference for common Git commands. Search, copy, and use Git commands instantly.
Set global username
Set global email
List all configurations
Set default text editor
Set default branch name
Set command alias
Cache credentials
Initialize a new repository
Initialize bare repository
Clone a remote repository
Clone specific branch
Shallow clone (latest commit only)
Clone with submodules
Check working directory status
Short status format
Add file to staging area
Add all changes
Add all changes including deletions
Interactive add (patch mode)
Delete file and stage
Remove file from staging
Rename file
Commit staged changes
Add and commit all changes
Amend last commit
Amend without changing message
List local branches
List all branches
List remote branches
List merged branches
Create new branch
Delete branch
Force delete branch
Rename branch
Switch branch
Create and switch branch
Track remote branch
Switch branch (new)
Create and switch (new)
Merge branch into current
Merge with no fast-forward
Squash merge (no commit)
Abort merge
Rebase onto branch
Interactive rebase last 3 commits
Continue rebase
Abort rebase
Cherry-pick a commit
View remote repositories
Add remote repository
Remove remote repository
Change remote URL
Fetch from remote
Fetch and prune remote branches
Pull and merge from remote
Pull with rebase
Push to remote
Push and set upstream
Force push
Force push with lease
Delete remote branch
View commit history
Compact history view
Compact graphical history
Full graphical history
Show change statistics
Show last 3 commits
Filter by author
Filter by time
Filter by commit message
View working directory changes
View staged changes
View all changes
git show <commit>Show commit details
Show line-by-line author
git shortlog -snAuthor commit count
List all tags
Create lightweight tag
Create annotated tag
Delete local tag
Push tag to remote
Push all tags
Delete remote tag
Stash current changes
Stash with message
Stash including untracked
List stashes
Show latest stash changes
Pop latest stash
Apply stash without removing
Drop latest stash
Clear all stashes
Create branch from stash
Unstage file
Soft reset to last commit
Mixed reset (default)
Hard reset to last commit
Revert a commit
Discard file changes
Restore file (new)
Unstage file (new)
Preview removing untracked
Remove untracked files and dirs
Add submodule
Init and update submodules
Update submodules recursively
Remove submodule
git reflogView reference log
git reflog show HEAD@{10}Show specific reference
git gcGarbage collection
git fsckCheck repository integrity
git archive -o latest.zip HEADExport repository as archive
git bundle create repo.bundle --allCreate repository bundle
git bundle unbundle repo.bundleUnbundle repository
git notes add -m "note" <commit>Add commit note
git filter-branch --force --index-filterRewrite history (use with caution)
Case sensitive filenames
Ignore file mode changes
Set default push mode
Default to rebase on pull
Enable reuse recorded resolution
git check-ignore -v <file>Check which rule ignores file
git ls-filesList tracked files
git ls-files --others --exclude-standardList untracked files
Create fixup commit
Create squash commit
Set upstream tracking
Unset upstream tracking
Edit branch description
Merge without committing
git merge-base <branch1> <branch2>Find common ancestor
Delete remote branch (old syntax)
Push and set upstream
Push with following tags
Custom format log
All branches graph log
git whatchangedShow what changed per commit
git diff-tree --no-commit-id --name-only -r <commit>Show commit changed files
Save stash (old syntax)
Create stash without storing
Store specific hash as stash
Revert last commit
Revert recent commit range
git update-index --assume-unchanged <file>Assume file unchanged
git update-index --no-assume-unchanged <file>Cancel assume unchanged
git update-index --skip-worktree <file>Skip worktree check
Add worktree
List worktrees
Remove worktree
Auto handle line endings
Enable colored output
Set merge tool
Set diff tool
Clone mirror repository
Clone single branch only
Clone specific tag
Dry run add operation
Force add ignored file
Remove from staging
Rename file
Amend without changing message
Allow empty commit
Show diff in commit message
Show branch verbose info
Find branches containing commit
Show unmerged branches
Abort merge
Continue merge
Get remote URL
Set tracking branches
Show remote details
Commits since 2 weeks ago
Commits until date
Filter by author
Search code changes
File history with diff
Create annotated tag
Delete tag
Delete remote tag
Create branch from stash
Clear all stashes
Soft reset last commit
Mixed reset (default)
Discard file changes
Run command on all submodules
Sync submodule URLs
git shortlog -snCommit summary by author
git describe --tagsDescribe nearest tag
Abort cherry-pick
Continue cherry-pick
Start bisect
Mark current as bad
Mark commit as good
End bisect
194 of 194 commands shown
Related Tools
More Code & Dev Tools
Color Converter
Free online color converter. Convert between HEX, RGB, HSL, ...
cURL Command Builder
Build cURL commands visually. Set URL, method, headers, body...
Systemd Service Generator
Generate systemd service unit files visually. Configure Exec...
Color Palette Generator
Generate harmonious color palettes online. Create color sche...
SQL Formatter
Format and beautify SQL queries online. Improve SQL readabil...
Color Contrast Checker
Check color contrast ratios for WCAG compliance. Ensure acce...
Port Checker
Check if a port is open online. Test port availability and c...
CSS Formatter
Format and minify CSS online. Beautify CSS code or compress ...
IP Calculator
Calculate IP ranges, subnet masks, and CIDR notation. Networ...
Docker Compose Generator
Generate Docker Compose YAML files visually. Add services, c...
WebSocket Tester
Test WebSocket connections and messages in real-time. Connec...
DNS Lookup
Query DNS records online. Look up A, AAAA, CNAME, MX, TXT, N...