简体   繁体   中英

How do I revert a hg rollback?

This may sound silly but when I wanted to revert a hg merge command, I issued "hg rollback".

Later i realized I have to use "hg update -C -r ." to clear the merged but uncommitted changes.

Now I want my last commit back. Is this possible ?

Maybe. The opposite of hg rollback is hg commit . If you didn't add/remove any files with hg add / remove / addremove , running hg commit once more should give you the state before the rollback.

But you're in the middle of a merge and hg commit doesn't support --dryRun , so I'm wary what would happen in this case. You will probably get an error but I'm not sure

To try this, just make a copy of the workspace somewhere else (ie copy the parent folder which contains the .hg folder). This is your whole project. You can try to fix the mess in the copy. If something breaks, you can always delete the copy and try something else.

Alternatively, you can clone the project using hg clone . If the project already includes messed up changesets, then you can exclude them with -r .

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