From 22dc13a4085a24d41f350def1057c7f1a1f81b3e Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 23 Aug 2019 18:22:38 +0100 Subject: [PATCH] git-restore: add page (#3247) --- pages/common/git-restore.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pages/common/git-restore.md 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 .`