git restore
Restore working tree files. Requires Git version 2.23+. See also:
git checkout,git reset. More information: https://git-scm.com/docs/git-restore.
- Restore an unstaged file to the staged version:
git restore
- Restore an unstaged file to the version of a specific commit:
git restore
- Discard all unstaged changes to tracked files:
git restore :/
- Unstage a file:
git restore
- Unstage all files:
git restore :/
- Discard all changes to files, both staged and unstaged:
git restore :/
- Interactively select sections of files to restore:
git restore
来源:tldr-pages contributors · 作者与贡献记录 · CC BY 4.0。离线整理了版式、链接和媒体显示。
