Restore the index entry for a path from HEAD.
Section: Restore Basics
Unstage a file with restore
bash
bash
git restore --staged path/to/fileExplanation
Modern alternative to `git reset HEAD path/to/file` when you only want to affect the staging area.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Restore Basics
Restore both index and working tree from another commit
Reset a file to another revision in both staging area and working tree.
Discard unstaged changes in a file
Restore a file in the working tree from the index.
Restore a file from another commit
Copy file contents from a specific commit into the working tree.
Interactively restore hunks
Select portions of a file to restore interactively.
Mental model for reset vs restore vs revert
Quick decision guide for the three similarly named commands.
Unstage a single file
Remove a path from the index without changing its contents in the working tree.