'\" t
.\" Title: git-restore
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 01/13/2023
.\" Manual: Git Manual
.\" Source: Git 2.39.1
.\" Language: English
.\"
.TH "GIT\-RESTORE" "1" "01/13/2023" "Git 2\&.39\&.1" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-restore \- Restore working tree files
.SH "SYNOPSIS"
.sp
.nf
\fIgit restore\fR [] [\-\-source=] [\-\-staged] [\-\-worktree] [\-\-] \&...
\fIgit restore\fR [] [\-\-source=] [\-\-staged] [\-\-worktree] \-\-pathspec\-from\-file= [\-\-pathspec\-file\-nul]
\fIgit restore\fR (\-p|\-\-patch) [] [\-\-source=] [\-\-staged] [\-\-worktree] [\-\-] [\&...]
.fi
.sp
.SH "DESCRIPTION"
.sp
Restore specified paths in the working tree with some contents from a restore source\&. If a path is tracked but does not exist in the restore source, it will be removed to match the source\&.
.sp
The command can also be used to restore the content in the index with \fB\-\-staged\fR, or restore both the working tree and the index with \fB\-\-staged \-\-worktree\fR\&.
.sp
By default, if \fB\-\-staged\fR is given, the contents are restored from \fBHEAD\fR, otherwise from the index\&. Use \fB\-\-source\fR to restore from a different commit\&.
.sp
See "Reset, restore and revert" in \fBgit\fR(1) for the differences between the three commands\&.
.sp
THIS COMMAND IS EXPERIMENTAL\&. THE BEHAVIOR MAY CHANGE\&.
.SH "OPTIONS"
.PP
\-s , \-\-source=
.RS 4
Restore the working tree files with the content from the given tree\&. It is common to specify the source tree by naming a commit, branch or tag associated with it\&.
.sp
If not specified, the contents are restored from
\fBHEAD\fR
if
\fB\-\-staged\fR
is given, otherwise from the index\&.
.sp
As a special case, you may use
\fB"A\&.\&.\&.B"\fR
as a shortcut for the merge base of
\fBA\fR
and
\fBB\fR
if there is exactly one merge base\&. You can leave out at most one of
\fBA\fR
and
\fBB\fR, in which case it defaults to
\fBHEAD\fR\&.
.RE
.PP
\-p, \-\-patch
.RS 4
Interactively select hunks in the difference between the restore source and the restore location\&. See the \(lqInteractive Mode\(rq section of
\fBgit-add\fR(1)
to learn how to operate the
\fB\-\-patch\fR
mode\&.
.sp
Note that
\fB\-\-patch\fR
can accept no pathspec and will prompt to restore all modified paths\&.
.RE
.PP
\-W, \-\-worktree, \-S, \-\-staged
.RS 4
Specify the restore location\&. If neither option is specified, by default the working tree is restored\&. Specifying
\fB\-\-staged\fR
will only restore the index\&. Specifying both restores both\&.
.RE
.PP
\-q, \-\-quiet
.RS 4
Quiet, suppress feedback messages\&. Implies
\fB\-\-no\-progress\fR\&.
.RE
.PP
\-\-progress, \-\-no\-progress
.RS 4
Progress status is reported on the standard error stream by default when it is attached to a terminal, unless
\fB\-\-quiet\fR
is specified\&. This flag enables progress reporting even if not attached to a terminal, regardless of
\fB\-\-quiet\fR\&.
.RE
.PP
\-\-ours, \-\-theirs
.RS 4
When restoring files in the working tree from the index, use stage #2 (\fIours\fR) or #3 (\fItheirs\fR) for unmerged paths\&.
.sp
Note that during
\fBgit rebase\fR
and
\fBgit pull \-\-rebase\fR,
\fIours\fR
and
\fItheirs\fR
may appear swapped\&. See the explanation of the same options in
\fBgit-checkout\fR(1)
for details\&.
.RE
.PP
\-m, \-\-merge
.RS 4
When restoring files on the working tree from the index, recreate the conflicted merge in the unmerged paths\&.
.RE
.PP
\-\-conflict=