3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Source: Git 2.36.1.153.gf9b95943b6
10 .TH "GIT\-REVERT" "1" "05/20/2022" "Git 2\&.36\&.1\&.153\&.gf9b959" "Git Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 git-revert \- Revert some existing commits
35 \fIgit revert\fR [\-\-[no\-]edit] [\-n] [\-m parent\-number] [\-s] [\-S[<keyid>]] <commit>\&...
36 \fIgit revert\fR (\-\-continue | \-\-skip | \-\-abort | \-\-quit)
41 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)\&.
43 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\&.
45 See "Reset, restore and revert" in \fBgit\fR(1) for the differences between the three commands\&.
50 Commits to revert\&. For a more complete list of ways to spell commit names, see
51 \fBgitrevisions\fR(7)\&. Sets of commits can also be given but no traversal is done by default, see
62 will let you edit the commit message prior to committing the revert\&. This is the default if you run the command from a terminal\&.
65 \-m parent\-number, \-\-mainline parent\-number
67 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\&.
69 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\&.
72 \m[blue]\fBrevert\-a\-faulty\-merge How\-To\fR\m[]\&\s-2\u[1]\d\s+2
80 will not start the commit message editor\&.
85 This option determines how the commit message will be cleaned up before being passed on to the commit machinery\&. See
87 for more details\&. In particular, if the
90 \fBscissors\fR, scissors will be appended to
92 before being passed on in the case of a conflict\&.
97 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\&.
99 This is useful when reverting more than one commits\(aq effect to your index in a row\&.
102 \-S[<keyid>], \-\-gpg\-sign[=<keyid>], \-\-no\-gpg\-sign
104 GPG\-sign commits\&. The
106 argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space\&.
107 \fB\-\-no\-gpg\-sign\fR
108 is useful to countermand both
109 \fBcommit\&.gpgSign\fR
110 configuration variable, and earlier
111 \fB\-\-gpg\-sign\fR\&.
117 \fBSigned\-off\-by\fR
118 trailer at the end of the commit message\&. See the signoff option in
120 for more information\&.
123 \-\-strategy=<strategy>
125 Use the given merge strategy\&. Should only be used once\&. See the MERGE STRATEGIES section in
130 \-X<option>, \-\-strategy\-option=<option>
132 Pass the merge strategy\-specific option through to the merge strategy\&. See
137 \-\-rerere\-autoupdate, \-\-no\-rerere\-autoupdate
139 Allow the rerere mechanism to update the index with the result of auto\-conflict resolution if possible\&.
141 .SH "SEQUENCER SUBCOMMANDS"
145 Continue the operation in progress using the information in
146 \fB\&.git/sequencer\fR\&. Can be used to continue after resolving conflicts in a failed cherry\-pick or revert\&.
151 Skip the current commit and continue with the rest of the sequence\&.
156 Forget about the current operation in progress\&. Can be used to clear the sequencer state after a failed cherry\-pick or revert\&.
161 Cancel the operation and return to the pre\-sequence state\&.
165 \fBgit revert HEAD~3\fR
167 Revert the changes specified by the fourth last commit in HEAD and create a new commit with the reverted changes\&.
170 \fBgit revert \-n master~5\&.\&.master~2\fR
172 Revert the changes done by commits from the fifth last commit in master (included) to the third last commit in master (included), but do not create any commit with the reverted changes\&. The revert only modifies the working tree and the index\&.
176 \fBgit-cherry-pick\fR(1)
179 Part of the \fBgit\fR(1) suite
182 revert-a-faulty-merge How-To
184 \%git-htmldocs/howto/revert-a-faulty-merge.html