Git Cheatsheet - Quick Git Command Reference
Quick reference for common Git commands. Search, copy, and use Git commands instantly.
git reset
Reset current HEAD to specified state
Syntax
git reset [options] [<commit>]Common Options
| Option | Description |
|---|---|
--soft | Soft reset: move HEAD only, keep staging and working tree |
--mixed | Mixed reset (default): move HEAD and reset staging |
--hard | Hard reset: move HEAD, reset staging and working tree |
HEAD~n | Go back n commits |
<file> | Unstage specific file |
Examples
git reset HEAD file.txtUnstage file
git reset --soft HEAD~1Undo last commit keeping changes
git reset --hard HEAD~1Permanently delete last commit and changes
git reset --hard origin/mainForce sync with remote main
Three Reset Modes Comparison
Working Directory State
SoftKeep staging area and working tree
Mixed (default)Keep working tree, clear staging area
HardDiscard all changes (use with caution)
Safety Tips
Before --hard, consider git stash or backup branch. Lost commits can be recovered via git reflog
Related Commands
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...