git restore
DestructiveRestore files
git restore <file>
Discards working changes, or unstages with --staged.
Examples
git restore --staged app.swiftUnstage a file
Syntax
git restore [--staged] <file>
Before you run it
Discarded uncommitted changes can't be recovered. Check the paths (especially .).
Related commands
- git resetReset state
- git statusWorking tree status
Check it once more before you run it
Some commands cannot be undone if one flag is wrong. An on-device reference works with no connection. Free to install, no ads (some content is a one-time purchase).
Get it free on the App Store