Mercurial: how do I revert to a particular revision?

前端 未结 3 1371
隐瞒了意图╮
隐瞒了意图╮ 2021-02-18 15:18

I\'m working on a live server. I\'ve updated to tip and it\'s caused problems: I need to revert back to a particular changeset (388) where things were OK.

I have no chan

相关标签:
3条回答
  • 2021-02-18 15:38

    I don't think it is really clear what you want but my interpretation would be hg update -C -rev 388 but you could equally well be after revert, or possibly (unlikely) even rollback. my answer to this question gives a good difference between update and revert

    you really need to work out what you want to see in the working copy AND what you want the state of the history to be like to choose between them

    0 讨论(0)
  • 2021-02-18 15:39

    Just use the command below, to get to a revision.

    hg revert -r REV
    

    It's conflicting with --all.

    To kill all local changes, --all should work.

    hg revert --all
    

    Don't use rollback. It's a irreversible procedure, so should be used with care.

    EDIT

    You can update with --clean option. That will discard any uncommitted change. And then update to some changeset.

    0 讨论(0)
  • 2021-02-18 15:40
    server:
    - ..
    - rev 386
    - rev 387
    - rev 388
    - rev 389
    
    clone to production
    
    -- testing stuff, it doesn't work!
    -- panic!
    -- rev 390 (in panic)
    -- rev 391 (in panic)
    -- cool down, thinking, need to go back to 388
    -- one way: hg update -C -rev 388 (to keep 390, 391)
    -- other way: rm -rf dir (to discard 390, 391)
    -- hg clone http://server/hg
    -- cd dir
    -- hg update 388 
    -- testing, now works
    

    There is also a wonderful Purge extension. Very solid stuff, it deletes all untracked files from working directory.

    0 讨论(0)
提交回复
热议问题