Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One way would be <del><a href="http://www.selenic.com/mercurial/hg.1.html#rollback" rel="nofollow noreferrer"><strong><code>hg rollback</code></strong></a></del> (deprecated as of Hg2.7, August 2013)</p> <blockquote> <p>Please use <a href="http://www.selenic.com/mercurial/hg.1.html#commit" rel="nofollow noreferrer"><code>hg commit --amend</code></a> instead of <code>rollback</code> to correct mistakes in the last commit.</p> <p>Roll back the last transaction in a repository.</p> <p>When <a href="http://www.selenic.com/mercurial/hg.1.html#commit" rel="nofollow noreferrer">committing</a> or <a href="https://www.mercurial-scm.org/wiki/Merge" rel="nofollow noreferrer">merging</a>, Mercurial adds the <a href="https://www.mercurial-scm.org/wiki/ChangeSet" rel="nofollow noreferrer">changeset</a> entry last.<br> Mercurial keeps a transaction log of the name of each file touched and its length prior to the transaction. On abort, it truncates each file to its prior length. This simplicity is one benefit of making <a href="https://www.mercurial-scm.org/wiki/Revlog" rel="nofollow noreferrer">revlogs</a> append-only. The transaction journal also allows an undo operation. </p> </blockquote> <p>See <a href="http://tortoisehg.bitbucket.io/manual/1.0/recovery.html" rel="nofollow noreferrer">TortoiseHg Recovery section</a>:</p> <p><img src="https://i.stack.imgur.com/OxQua.png" alt="alt text"></p> <p><a href="http://www.selenic.com/pipermail/mercurial/2009-July/026834.html" rel="nofollow noreferrer">This thread</a> also details the difference between <code>hg rollback</code> and <code>hg strip</code>:<br> (written by <a href="https://stackoverflow.com/users/110204/martin-geisler">Martin Geisler</a> who also contributes on SO)</p> <blockquote> <ul> <li><p>'<code>hg rollback</code>' will remove the last transaction. Transactions are a concept often found in databases. In Mercurial we start a transaction when certain operations are run, such as commit, push, pull...<br> When the operation finishes succesfully, the transaction is marked as complete. If an error occurs, the transaction is "rolled back" and the repository is left in the same state as before.<br> You can manually trigger a rollback with 'hg rollback'. This will undo the last transactional command. If a pull command brought 10 new changesets into the repository on different branches, then '<code>hg rollback</code>' will remove them all. Please note: there is <em>no backup</em> when you rollback a transaction!</p></li> <li><p>'<code>hg strip</code>' will remove a changeset and all its descendants. The changesets are saved as a bundle, which you can apply again if you need them back.</p></li> </ul> </blockquote> <p><a href="https://stackoverflow.com/users/1286571/foreverwintr">ForeverWintr</a> suggests in the comments (in 2016, 5 years later)</p> <blockquote> <p>You can 'un-commit' files by first hg forgetting them, e.g.: <code>hg forget filea; hg commit --amend</code>, but that seems unintuitive.<br> <a href="https://stackoverflow.com/a/19064016/6309"><code>hg strip --keep</code></a> is probably a better solution for modern hg.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload