Accidentally staged files you didn’t mean to commit? git restore unstages them without deleting changes.
Unstage Specific File:
# Staged config.json by mistake git add config.json # Unstage it (keeps changes in working directory) git restore --staged config.json
Unstage All Files:
git restore --staged .
Discard Changes (Careful!):
# Unstage AND discard changes git restore config.json # This deletes your changes permanently!
Old vs New:
# Old confusing way: git reset HEAD config.json # New clear way: git restore --staged config.json
