diff --git a/pages/common/git-restore.md b/pages/common/git-restore.md new file mode 100644 index 0000000000..c8b5e9b8ed --- /dev/null +++ b/pages/common/git-restore.md @@ -0,0 +1,17 @@ +# git restore + +> Restore working tree files. Requires git version 2.23+. +> See also `git checkout`. +> More information: . + +- 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 .`