'\" t
.\" Title: git-revert
.\" Author: [see the "Author" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2
.\" Date: 05/09/2012
.\" Manual: Git Manual
.\" Source: Git 1.6.4.2
.\" Language: English
.\"
.TH "GIT\-REVERT" "1" "05/09/2012" "Git 1\&.6\&.4\&.2" "Git Manual"
.\" -----------------------------------------------------------------
.\" * 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 an existing commit
.SH "SYNOPSIS"
.sp
\fIgit revert\fR [\-\-edit | \-\-no\-edit] [\-n] [\-m parent\-number] [\-s]
.SH "DESCRIPTION"
.sp
Given one existing commit, revert the change the patch introduces, and record a new commit that records it\&. This requires your working tree to be clean (no modifications from the HEAD commit)\&.
.sp
Note: \fIgit revert\fR is used to record a new commit to reverse the effect of an earlier commit (often 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 \fI\-\-hard\fR option\&. If you want to extract specific files as they were in another commit, you should see \fBgit-checkout\fR(1), specifically the \fIgit checkout \(em \fR syntax\&. Take care with these alternatives as both will discard uncommitted changes in your working directory\&.
.SH "OPTIONS"
.PP
.RS 4
Commit to revert\&. For a more complete list of ways to spell commit names, see "SPECIFYING REVISIONS" section in
\fBgit-rev-parse\fR(1)\&.
.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
\-n, \-\-no\-commit
.RS 4
Usually the command automatically creates a commit with a commit log message stating which commit was reverted\&. This flag applies the change necessary to revert the named commit to your working tree and the index, but does not make the commit\&. 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\' effect to your index in a row\&.
.RE
.PP
\-s, \-\-signoff
.RS 4
Add Signed\-off\-by line at the end of the commit message\&.
.RE
.SH "AUTHOR"
.sp
Written by Junio C Hamano
.SH "DOCUMENTATION"
.sp
Documentation by Junio C Hamano and the git\-list \&.
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite
.SH "NOTES"
.IP " 1." 4
revert-a-faulty-merge How-To
.RS 4
\%[set $man.base.url.for.relative.links]/howto/revert-a-faulty-merge.txt
.RE
.IP " 2." 4
gitster@pobox.com
.RS 4
\%mailto:gitster@pobox.com
.RE
.IP " 3." 4
git@vger.kernel.org
.RS 4
\%mailto:git@vger.kernel.org
.RE