Fix some links
[TortoiseGit.git] / doc / source / en / TortoiseGit / git_doc / git-revert.xml
blob0e9c7c612ba6d00959db5fc77b22f4ed77bd7bce
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
3 \r
4 <sect2 lang="en" id="git-revert(1)">\r
5     <title>git-revert(1)</title>\r
6 <indexterm>\r
7 <primary>git-revert(1)</primary>\r
8 </indexterm>\r
9 <simplesect id="git-revert(1)__name">\r
10 <title>NAME</title>\r
11 <simpara>git-revert - Revert some existing commits</simpara>\r
12 </simplesect>\r
13 <simplesect id="git-revert(1)__synopsis">\r
14 <title>SYNOPSIS</title>\r
15 <blockquote>\r
16 <literallayout><emphasis>git revert</emphasis> [--[no-]edit] [-n] [-m parent-number] [-s] [-S[&lt;keyid&gt;]] &lt;commit&gt;&#8230;\r
17 <emphasis>git revert</emphasis> --continue\r
18 <emphasis>git revert</emphasis> --quit\r
19 <emphasis>git revert</emphasis> --abort</literallayout>\r
20 </blockquote>\r
21 </simplesect>\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 &lt;commit&gt; -- &lt;filename&gt;</emphasis> syntax.  Take care with these alternatives as\r
35 both will discard uncommitted changes in your working directory.</simpara>\r
36 </simplesect>\r
37 <simplesect id="git-revert(1)__options">\r
38 <title>OPTIONS</title>\r
39 <variablelist>\r
40 <varlistentry>\r
41 <term>\r
42 &lt;commit&gt;&#8230;\r
43 </term>\r
44 <listitem>\r
45 <simpara>\r
46         Commits to revert.\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
51         option.\r
52 </simpara>\r
53 </listitem>\r
54 </varlistentry>\r
55 <varlistentry>\r
56 <term>\r
57 -e\r
58 </term>\r
59 <term>\r
60 --edit\r
61 </term>\r
62 <listitem>\r
63 <simpara>\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
67 </simpara>\r
68 </listitem>\r
69 </varlistentry>\r
70 <varlistentry>\r
71 <term>\r
72 -m parent-number\r
73 </term>\r
74 <term>\r
75 --mainline parent-number\r
76 </term>\r
77 <listitem>\r
78 <simpara>\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
84 </simpara>\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
91 </listitem>\r
92 </varlistentry>\r
93 <varlistentry>\r
94 <term>\r
95 --no-edit\r
96 </term>\r
97 <listitem>\r
98 <simpara>\r
99         With this option, <emphasis>git revert</emphasis> will not start the commit\r
100         message editor.\r
101 </simpara>\r
102 </listitem>\r
103 </varlistentry>\r
104 <varlistentry>\r
105 <term>\r
106 -n\r
107 </term>\r
108 <term>\r
109 --no-commit\r
110 </term>\r
111 <listitem>\r
112 <simpara>\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
121 </simpara>\r
122 <simpara>This is useful when reverting more than one commits'\r
123 effect to your index in a row.</simpara>\r
124 </listitem>\r
125 </varlistentry>\r
126 <varlistentry>\r
127 <term>\r
128 -S[&lt;keyid&gt;]\r
129 </term>\r
130 <term>\r
131 --gpg-sign[=&lt;keyid&gt;]\r
132 </term>\r
133 <listitem>\r
134 <simpara>\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
138 </simpara>\r
139 </listitem>\r
140 </varlistentry>\r
141 <varlistentry>\r
142 <term>\r
143 -s\r
144 </term>\r
145 <term>\r
146 --signoff\r
147 </term>\r
148 <listitem>\r
149 <simpara>\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
152 </simpara>\r
153 </listitem>\r
154 </varlistentry>\r
155 <varlistentry>\r
156 <term>\r
157 --strategy=&lt;strategy&gt;\r
158 </term>\r
159 <listitem>\r
160 <simpara>\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
163         for details.\r
164 </simpara>\r
165 </listitem>\r
166 </varlistentry>\r
167 <varlistentry>\r
168 <term>\r
169 -X&lt;option&gt;\r
170 </term>\r
171 <term>\r
172 --strategy-option=&lt;option&gt;\r
173 </term>\r
174 <listitem>\r
175 <simpara>\r
176         Pass the merge strategy-specific option through to the\r
177         merge strategy.  See <xref linkend="git-merge(1)" /> for details.\r
178 </simpara>\r
179 </listitem>\r
180 </varlistentry>\r
181 </variablelist>\r
182 </simplesect>\r
183 <simplesect id="git-revert(1)__sequencer_subcommands">\r
184 <title>SEQUENCER SUBCOMMANDS</title>\r
185 <variablelist>\r
186 <varlistentry>\r
187 <term>\r
188 --continue\r
189 </term>\r
190 <listitem>\r
191 <simpara>\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
195 </simpara>\r
196 </listitem>\r
197 </varlistentry>\r
198 <varlistentry>\r
199 <term>\r
200 --quit\r
201 </term>\r
202 <listitem>\r
203 <simpara>\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
206         revert.\r
207 </simpara>\r
208 </listitem>\r
209 </varlistentry>\r
210 <varlistentry>\r
211 <term>\r
212 --abort\r
213 </term>\r
214 <listitem>\r
215 <simpara>\r
216         Cancel the operation and return to the pre-sequence state.\r
217 </simpara>\r
218 </listitem>\r
219 </varlistentry>\r
220 </variablelist>\r
221 </simplesect>\r
222 <simplesect id="git-revert(1)__examples">\r
223 <title>EXAMPLES</title>\r
224 <variablelist>\r
225 <varlistentry>\r
226 <term>\r
227 <emphasis>git revert HEAD~3</emphasis>\r
228 </term>\r
229 <listitem>\r
230 <simpara>\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
233 </simpara>\r
234 </listitem>\r
235 </varlistentry>\r
236 <varlistentry>\r
237 <term>\r
238 <emphasis>git revert -n master~5..master~2</emphasis>\r
239 </term>\r
240 <listitem>\r
241 <simpara>\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
246         index.\r
247 </simpara>\r
248 </listitem>\r
249 </varlistentry>\r
250 </variablelist>\r
251 </simplesect>\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
255 </simplesect>\r
256 <simplesect id="git-revert(1)__git">\r
257 <title>GIT</title>\r
258 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>\r
259 </simplesect>\r
260 </sect2>\r