Cheatsheet Pages / Git Cheatsheet

How to unstage a file in Git and keep your edits — git restore --staged

You staged a file by accident and want it out of the next commit without losing the edits.

git restore --staged <file>   # unstage, keep edits

Good to know

Removes the file from the staging area; your working-tree changes stay.

Git Cheatsheet one-page card — 30 daily and rescue commands
The full one-page card — Git Cheatsheet. Get the complete cheatsheet on GitHub