Skip to content
Merged
Changes from all 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 deleted file from the contents of the current commit (HEAD):

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

- Restore a file to a version from a different commit:

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

- Undo any uncommitted changes to tracked files, reverting to the current HEAD:

`git restore .`