| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" /> |
| 7 |
<title>hg revert</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="hg-revert"> |
| 12 |
<span id="hg-revert-1"></span> |
| 13 |
<h1 class="title">hg revert</h1> |
| 14 |
<h2 class="subtitle" id="restore-files-to-their-checkout-state">restore files to their checkout state</h2> |
| 15 |
|
| 16 |
<div class="contents htmlonly topic" id="contents"> |
| 17 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 18 |
<ul class="simple"> |
| 19 |
<li><a class="reference internal" href="#synopsis" id="toc-entry-1">Synopsis</a></li> |
| 20 |
<li><a class="reference internal" href="#description" id="toc-entry-2">Description</a></li> |
| 21 |
<li><a class="reference internal" href="#options" id="toc-entry-3">Options</a></li> |
| 22 |
</ul> |
| 23 |
</div> |
| 24 |
<div class="section" id="synopsis"> |
| 25 |
<h1><a class="toc-backref" href="#contents">Synopsis</a></h1> |
| 26 |
<pre class="literal-block"> |
| 27 |
hg revert [OPTION]... [-r REV] [NAME]... |
| 28 |
</pre> |
| 29 |
</div> |
| 30 |
<div class="section" id="description"> |
| 31 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 32 |
<div class="admonition note"> |
| 33 |
<p class="first admonition-title">Note</p> |
| 34 |
<p class="last">To check out earlier revisions, you should use <a class="reference external" href="hg-update.html"><tt class="docutils literal">hg update REV</tt></a>. |
| 35 |
To cancel an uncommitted merge (and lose your changes), |
| 36 |
use <a class="reference external" href="hg-merge.html"><tt class="docutils literal">hg merge <span class="pre">--abort</span></tt></a>.</p> |
| 37 |
</div> |
| 38 |
<p>With no revision specified, revert the specified files or directories |
| 39 |
to the contents they had in the parent of the working directory. |
| 40 |
This restores the contents of files to an unmodified |
| 41 |
state and unschedules adds, removes, copies, and renames. If the |
| 42 |
working directory has two parents, you must explicitly specify a |
| 43 |
revision.</p> |
| 44 |
<p>Using the -r/--rev or -d/--date options, revert the given files or |
| 45 |
directories to their states as of a specific revision. Because |
| 46 |
revert does not change the working directory parents, this will |
| 47 |
cause these files to appear modified. This can be helpful to "back |
| 48 |
out" some or all of an earlier change. See <a class="reference external" href="hg-backout.html"><tt class="docutils literal">hg backout</tt></a> for a |
| 49 |
related method.</p> |
| 50 |
<p>Modified files are saved with a .orig suffix before reverting. |
| 51 |
To disable these backups, use --no-backup. It is possible to store |
| 52 |
the backup files in a custom directory relative to the root of the |
| 53 |
repository by setting the <tt class="docutils literal">ui.origbackuppath</tt> configuration |
| 54 |
option.</p> |
| 55 |
<p>See <a class="reference external" href="topic-dates.html"><tt class="docutils literal">hg help dates</tt></a> for a list of formats valid for -d/--date.</p> |
| 56 |
<p>See <a class="reference external" href="hg-backout.html"><tt class="docutils literal">hg help backout</tt></a> for a way to reverse the effect of an |
| 57 |
earlier changeset.</p> |
| 58 |
<p>Returns 0 on success.</p> |
| 59 |
</div> |
| 60 |
<div class="section" id="options"> |
| 61 |
<h1><a class="toc-backref" href="#contents">Options</a></h1> |
| 62 |
<table class="docutils option-list" frame="void" rules="none"> |
| 63 |
<col class="option" /> |
| 64 |
<col class="description" /> |
| 65 |
<tbody valign="top"> |
| 66 |
<tr><td class="option-group"> |
| 67 |
<kbd><span class="option">-a</span>, <span class="option">--all</span></kbd></td> |
| 68 |
<td>revert all changes when no arguments given</td></tr> |
| 69 |
<tr><td class="option-group" colspan="2"> |
| 70 |
<kbd><span class="option">-d</span>, <span class="option">--date <var><DATE></var></span></kbd></td> |
| 71 |
</tr> |
| 72 |
<tr><td> </td><td>tipmost revision matching date</td></tr> |
| 73 |
<tr><td class="option-group" colspan="2"> |
| 74 |
<kbd><span class="option">-r</span>, <span class="option">--rev <var><REV></var></span></kbd></td> |
| 75 |
</tr> |
| 76 |
<tr><td> </td><td>revert to the specified revision</td></tr> |
| 77 |
<tr><td class="option-group" colspan="2"> |
| 78 |
<kbd><span class="option">-C</span>, <span class="option">--no-backup</span></kbd></td> |
| 79 |
</tr> |
| 80 |
<tr><td> </td><td>do not save backup copies of files</td></tr> |
| 81 |
<tr><td class="option-group" colspan="2"> |
| 82 |
<kbd><span class="option">-i</span>, <span class="option">--interactive</span></kbd></td> |
| 83 |
</tr> |
| 84 |
<tr><td> </td><td>interactively select the changes</td></tr> |
| 85 |
<tr><td class="option-group" colspan="2"> |
| 86 |
<kbd><span class="option">-I</span>, <span class="option">--include <var><PATTERN[+]></var></span></kbd></td> |
| 87 |
</tr> |
| 88 |
<tr><td> </td><td>include names matching the given patterns</td></tr> |
| 89 |
<tr><td class="option-group" colspan="2"> |
| 90 |
<kbd><span class="option">-X</span>, <span class="option">--exclude <var><PATTERN[+]></var></span></kbd></td> |
| 91 |
</tr> |
| 92 |
<tr><td> </td><td>exclude names matching the given patterns</td></tr> |
| 93 |
<tr><td class="option-group"> |
| 94 |
<kbd><span class="option">-n</span>, <span class="option">--dry-run</span></kbd></td> |
| 95 |
<td>do not perform actions, just print output</td></tr> |
| 96 |
</tbody> |
| 97 |
</table> |
| 98 |
<p>[+] marked option can be specified multiple times</p> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
</body> |
| 102 |
</html> |