Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pages/common/git-restore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# git restore

> Restore working tree files. Requires git version 2.23+.
> See also `git checkout`.
> More information: <https://git-scm.com/docs/git-restore/>.

- Restore a file that was accidentally deleted:

`git restore {{path/to/file}}`

- Restore a file to an earlier version:

`git restore --source {{commit}} {{path/to/file}}`

- Restore all the files in the current working tree to the last committed version:

`git restore .`