Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/Documentation/git-restore.adoc # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / Documentation / git-restore.adoc` 219 lines ยท 7066 bytes Raw Blame History 1 git-restore(1) 2 ============== 3 4 NAME 5 ---- 6 git-restore - Restore working tree files 7 8 SYNOPSIS 9 -------- 10 [synopsis] 11 git restore [] [--source=] [--staged] [--worktree] [--] ... 12 git restore [] [--source=] [--staged] [--worktree] --pathspec-from-file= [--pathspec-file-nul] 13 git restore (-p|--patch) [] [--source=] [--staged] [--worktree] [--] [...] 14 15 DESCRIPTION 16 ----------- 17 Restore specified paths in the working tree with some contents from a 18 restore source. If a path is tracked but does not exist in the restore 19 source, it will be removed to match the source. 20 21 The command can also be used to restore the content in the index with 22 `--staged`, or restore both the working tree and the index with 23 `--staged --worktree`. 24 25 By default, if `--staged` is given, the contents are restored from `HEAD`, 26 otherwise from the index. Use `--source` to restore from a different commit. 27 28 See "Reset, restore and revert" in linkgit:git[1] for the differences 29 between the three commands. 30 31 OPTIONS 32 ------- 33 `-s `:: 34 `--source=`:: 35 Restore the working tree files with the content from the given 36 tree. It is common to specify the source tree by naming a 37 commit, branch or tag associated with it. 38 + 39 If not specified, the contents are restored from `HEAD` if `--staged` is 40 given, otherwise from the index. 41 + 42 As a special case, you may use `"..."` as a shortcut for the 43 merge base of __ and __ if there is exactly one merge base. You can 44 leave out at most one of __ and __, in which case it defaults to `HEAD`. 45 46 `-p`:: 47 `--patch`:: 48 Interactively select hunks in the difference between the 49 restore source and the restore location. See the "Interactive 50 Mode" section of linkgit:git-add[1] to learn how to operate 51 the `--patch` mode. 52 53 include::diff-context-options.adoc[] 54 55 `-W`:: 56 `--worktree`:: 57 `-S`:: 58 `--staged`:: 59 Specify the restore location. If neither option is specified, 60 by default the working tree is restored. Specifying `--staged` 61 will only restore the index. Specifying both restores both. 62 63 `-q`:: 64 `--quiet`:: 65 Quiet, suppress feedback messages. Implies `--no-progress`. 66 67 `--progress`:: 68 `--no-progress`:: 69 Progress status is reported on the standard error stream 70 by default when it is attached to a terminal, unless `--quiet` 71 is specified. This flag enables progress reporting even if not 72 attached to a terminal, regardless of `--quiet`. 73 74 `--ours`:: 75 `--theirs`:: 76 When restoring files in the working tree from the index, use 77 stage #2 (`ours`) or #3 (`theirs`) for unmerged paths. 78 This option cannot be used when checking out paths from a 79 tree-ish (i.e. with the `--source` option). 80 + 81 Note that during `git rebase` and `git pull --rebase`, `ours` and 82 `theirs` may appear swapped. See the explanation of the same options 83 in linkgit:git-checkout[1] for details. 84 85 `-m`:: 86 `--merge`:: 87 When restoring files on the working tree from the index, 88 recreate the conflicted merge in the unmerged paths. 89 This option cannot be used when checking out paths from a 90 tree-ish (i.e. with the `--source` option). 91 92 `--conflict=