简体   繁体   中英

hg rollback Alternative to Undo Changes?

hg rollback was the easy way to simply undo your last local Mercurial repository transaction.

Sadly hg rollback has been deprecated as of Hg2.7 August 2013

Most of the question/answers are seeking solution to undo "Write nature" commands easily doable with strip or other "Delete nature" commands.

But what happens with delete related commands? I rebased and Collapsed a set of commits (all from the same branch) into one.

Now how do i undo this action???

I suggest to look into both: mercurial phases and the evolve extension of mercurial. Using the either secret or draft phase as your default phase you then can easily undo anything you did not yet push (which usually makes them public, thus immutable) as old changesets are kept as obsolete changesets which you can revive if needed.

The old, pre-squashed commits may be there -- just hidden (depending exactly how your collapse command works).

Step one is the find the hashes that you care about. I use the smartlog extension, so this is 'hg sl --hidden --all', but some form of 'hg --hidden log' should work for you too. If you are lucky enough to still have a screenshot with the expected hashes that's better.

Step two is to recover those commits. I did it by attaching a bookmark to each of the commits I wanted back.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM