Find the exact Git commands for your scenario: undoing commits, branching, stashing, rebasing, and disaster recovery.
Reliable SSD droplets, managed databases, and Kubernetes clusters deployed in seconds.
Claim $200 free creditThe open source Firebase alternative. Dedicated Postgres DB, instant Auth, and REST/GraphQL APIs.
Start free projectProtect your developer workstations, APIs, and DNS queries with fast, encrypted tunnels.
Get 74% off dealAffiliate Disclosure: We may earn a commission from partner signups at zero cost to you, which funds our free tools and ad-free hosting.
Run `git reset --soft HEAD~1`. Your changes will remain staged in the index.
Run `git restore .` and `git clean -fd` to remove untracked files.
Each command in this cheatsheet is labeled with its safety level (Safe, Modifies, or Destructive).