Mercurial: back, the last change, so that the code base is clean?

I just messed up something in Mercurial.

How can I undo the last change so that the codebase is clean - in particular, so that if someone else does "hg pull", they will have a working codebase?

+3
source share
3 answers

Two ways:

hg rollbackas Fred mentioned; if you have already pushed, it's too late. hg rollbackSuitable for local use only. hg strip(also mentioned by Fred) works the same and (with the exception of backup support) is equivalent to doing it hg rollbackseveral times until you get back to this revision.

hg backout, ( , , , , ).

, , ( - ).

+4

- . , 6 . 5:

hg clone -r 5 myrepobad myrepoclean

myrepoclean , . , , , checkin, .

+2
$ hg rollback --help
hg rollback

roll back the last transaction (dangerous)

    This command should be used with care. There is only one level of rollback,
    and there is no way to undo a rollback. It will also restore the dirstate at
    the time of the last transaction, losing any dirstate changes since that
    time. This command does not alter the working directory.

...

You should also look at the strip command.

+1
source

Source: https://habr.com/ru/post/1775821/


All Articles