Showing posts with label Git Restore. Show all posts
Showing posts with label Git Restore. Show all posts

How to Undo git add Before You Commit (Unstage Files Safely)

Quick answer: run git restore --staged <file> (modern Git) or git reset <file> (works everywhere) to unstage a file you added by mistake, before it's committed.