1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect2 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
\r
4 <sect2 lang="en" id="git-revert(1)">
\r
5 <title>git-revert(1)</title>
\r
7 <primary>git-revert(1)</primary>
\r
9 <simplesect id="git-revert(1)__name">
\r
11 <simpara>git-revert - Revert some existing commits</simpara>
\r
13 <simplesect id="git-revert(1)__synopsis">
\r
14 <title>SYNOPSIS</title>
\r
16 <literallayout><emphasis>git revert</emphasis> [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>…
\r
17 <emphasis>git revert</emphasis> --continue
\r
18 <emphasis>git revert</emphasis> --quit
\r
19 <emphasis>git revert</emphasis> --abort</literallayout>
\r
22 <simplesect id="git-revert(1)__description">
\r
23 <title>DESCRIPTION</title>
\r
24 <simpara>Given one or more existing commits, revert the changes that the
\r
25 related patches introduce, and record some new commits that record
\r
26 them. This requires your working tree to be clean (no modifications
\r
27 from the HEAD commit).</simpara>
\r
28 <simpara>Note: <emphasis>git revert</emphasis> is used to record some new commits to reverse the
\r
29 effect of some earlier commits (often only a faulty one). If you want to
\r
30 throw away all uncommitted changes in your working directory, you
\r
31 should see <xref linkend="git-reset(1)" />, particularly the <emphasis>--hard</emphasis> option. If
\r
32 you want to extract specific files as they were in another commit, you
\r
33 should see <xref linkend="git-checkout(1)" />, specifically the <emphasis>git checkout
\r
34 <commit> -- <filename></emphasis> syntax. Take care with these alternatives as
\r
35 both will discard uncommitted changes in your working directory.</simpara>
\r
37 <simplesect id="git-revert(1)__options">
\r
38 <title>OPTIONS</title>
\r
42 <commit>…
\r
47 For a more complete list of ways to spell commit names, see
\r
48 <xref linkend="gitrevisions(7)" />.
\r
49 Sets of commits can also be given but no traversal is done by
\r
50 default, see <xref linkend="git-rev-list(1)" /> and its <emphasis>--no-walk</emphasis>
\r
64 With this option, <emphasis>git revert</emphasis> will let you edit the commit
\r
65 message prior to committing the revert. This is the default if
\r
66 you run the command from a terminal.
\r
75 --mainline parent-number
\r
79 Usually you cannot revert a merge because you do not know which
\r
80 side of the merge should be considered the mainline. This
\r
81 option specifies the parent number (starting from 1) of
\r
82 the mainline and allows revert to reverse the change
\r
83 relative to the specified parent.
\r
85 <simpara>Reverting a merge commit declares that you will never want the tree changes
\r
86 brought in by the merge. As a result, later merges will only bring in tree
\r
87 changes introduced by commits that are not ancestors of the previously
\r
88 reverted merge. This may or may not be what you want.</simpara>
\r
89 <simpara>See the <ulink url="https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.html"><citetitle>revert-a-faulty-merge How-To</citetitle></ulink> for
\r
90 more details.</simpara>
\r
99 With this option, <emphasis>git revert</emphasis> will not start the commit
\r
113 Usually the command automatically creates some commits with
\r
114 commit log messages stating which commits were
\r
115 reverted. This flag applies the changes necessary
\r
116 to revert the named commits to your working tree
\r
117 and the index, but does not make the commits. In addition,
\r
118 when this option is used, your index does not have to match
\r
119 the HEAD commit. The revert is done against the
\r
120 beginning state of your index.
\r
122 <simpara>This is useful when reverting more than one commits'
\r
123 effect to your index in a row.</simpara>
\r
131 --gpg-sign[=<keyid>]
\r
135 GPG-sign commits. The <emphasis>keyid</emphasis> argument is optional and
\r
136 defaults to the committer identity; if specified, it must be
\r
137 stuck to the option without a space.
\r
150 Add Signed-off-by line at the end of the commit message.
\r
151 See the signoff option in <xref linkend="git-commit(1)" /> for more information.
\r
157 --strategy=<strategy>
\r
161 Use the given merge strategy. Should only be used once.
\r
162 See the MERGE STRATEGIES section in <xref linkend="git-merge(1)" />
\r
172 --strategy-option=<option>
\r
176 Pass the merge strategy-specific option through to the
\r
177 merge strategy. See <xref linkend="git-merge(1)" /> for details.
\r
183 <simplesect id="git-revert(1)__sequencer_subcommands">
\r
184 <title>SEQUENCER SUBCOMMANDS</title>
\r
192 Continue the operation in progress using the information in
\r
193 <emphasis>.git/sequencer</emphasis>. Can be used to continue after resolving
\r
194 conflicts in a failed cherry-pick or revert.
\r
204 Forget about the current operation in progress. Can be used
\r
205 to clear the sequencer state after a failed cherry-pick or
\r
216 Cancel the operation and return to the pre-sequence state.
\r
222 <simplesect id="git-revert(1)__examples">
\r
223 <title>EXAMPLES</title>
\r
227 <emphasis>git revert HEAD~3</emphasis>
\r
231 Revert the changes specified by the fourth last commit in HEAD
\r
232 and create a new commit with the reverted changes.
\r
238 <emphasis>git revert -n master~5..master~2</emphasis>
\r
242 Revert the changes done by commits from the fifth last commit
\r
243 in master (included) to the third last commit in master
\r
244 (included), but do not create any commit with the reverted
\r
245 changes. The revert only modifies the working tree and the
\r
252 <simplesect id="git-revert(1)__see_also">
\r
253 <title>SEE ALSO</title>
\r
254 <simpara><xref linkend="git-cherry-pick(1)" /></simpara>
\r
256 <simplesect id="git-revert(1)__git">
\r
258 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
\r