'\" t
.\" Title: git-revert
.\" 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\-REVERT" "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-revert \- Revert some existing commits
.SH "SYNOPSIS"
.sp
.nf
\fIgit revert\fR [\-\-[no\-]edit] [\-n] [\-m ] [\-s] [\-S[]] \&...
\fIgit revert\fR (\-\-continue | \-\-skip | \-\-abort | \-\-quit)
.fi
.sp
.SH "DESCRIPTION"
.sp
Given one or more existing commits, revert the changes that the related patches introduce, and record some new commits that record them\&. This requires your working tree to be clean (no modifications from the HEAD commit)\&.
.sp
Note: \fIgit revert\fR is used to record some new commits to reverse the effect of some earlier commits (often only a faulty one)\&. If you want to throw away all uncommitted changes in your working directory, you should see \fBgit-reset\fR(1), particularly the \fB\-\-hard\fR option\&. If you want to extract specific files as they were in another commit, you should see \fBgit-restore\fR(1), specifically the \fB\-\-source\fR option\&. Take care with these alternatives as both will discard uncommitted changes in your working directory\&.
.sp
See "Reset, restore and revert" in \fBgit\fR(1) for the differences between the three commands\&.
.SH "OPTIONS"
.PP
\&...
.RS 4
Commits to revert\&. For a more complete list of ways to spell commit names, see
\fBgitrevisions\fR(7)\&. Sets of commits can also be given but no traversal is done by default, see
\fBgit-rev-list\fR(1)
and its
\fB\-\-no\-walk\fR
option\&.
.RE
.PP
\-e, \-\-edit
.RS 4
With this option,
\fIgit revert\fR
will let you edit the commit message prior to committing the revert\&. This is the default if you run the command from a terminal\&.
.RE
.PP
\-m parent\-number, \-\-mainline parent\-number
.RS 4
Usually you cannot revert a merge because you do not know which side of the merge should be considered the mainline\&. This option specifies the parent number (starting from 1) of the mainline and allows revert to reverse the change relative to the specified parent\&.
.sp
Reverting a merge commit declares that you will never want the tree changes brought in by the merge\&. As a result, later merges will only bring in tree changes introduced by commits that are not ancestors of the previously reverted merge\&. This may or may not be what you want\&.
.sp
See the
\m[blue]\fBrevert\-a\-faulty\-merge How\-To\fR\m[]\&\s-2\u[1]\d\s+2
for more details\&.
.RE
.PP
\-\-no\-edit
.RS 4
With this option,
\fIgit revert\fR
will not start the commit message editor\&.
.RE
.PP
\-\-cleanup=
.RS 4
This option determines how the commit message will be cleaned up before being passed on to the commit machinery\&. See
\fBgit-commit\fR(1)
for more details\&. In particular, if the
\fI\fR
is given a value of
\fBscissors\fR, scissors will be appended to
\fBMERGE_MSG\fR
before being passed on in the case of a conflict\&.
.RE
.PP
\-n, \-\-no\-commit
.RS 4
Usually the command automatically creates some commits with commit log messages stating which commits were reverted\&. This flag applies the changes necessary to revert the named commits to your working tree and the index, but does not make the commits\&. In addition, when this option is used, your index does not have to match the HEAD commit\&. The revert is done against the beginning state of your index\&.
.sp
This is useful when reverting more than one commits\*(Aq effect to your index in a row\&.
.RE
.PP
\-S[], \-\-gpg\-sign[=], \-\-no\-gpg\-sign
.RS 4
GPG\-sign commits\&. The
\fBkeyid\fR
argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space\&.
\fB\-\-no\-gpg\-sign\fR
is useful to countermand both
\fBcommit\&.gpgSign\fR
configuration variable, and earlier
\fB\-\-gpg\-sign\fR\&.
.RE
.PP
\-s, \-\-signoff
.RS 4
Add a
\fBSigned\-off\-by\fR
trailer at the end of the commit message\&. See the signoff option in
\fBgit-commit\fR(1)
for more information\&.
.RE
.PP
\-\-strategy=
.RS 4
Use the given merge strategy\&. Should only be used once\&. See the MERGE STRATEGIES section in
\fBgit-merge\fR(1)
for details\&.
.RE
.PP
\-X