Difference between Revert and Update in Mercurial

后端 未结 1 1728
别跟我提以往
别跟我提以往 2020-12-07 16:55

I\'m just getting started with Mercurial, and I\'ve come across something which I don\'t understand.

I made changes to several files, and now I want to undo all the

相关标签:
1条回答
  • 2020-12-07 17:11

    The first difference is revert can work on a subset of the working copy while update works on the whole working copy. the other difference is in what happens when you want to go back to a version other than the last committed one.

    if we have revisions (caps are committed, lower case are changes in the working copy, parent revision is C )

    A-B-C-d
    

    update -C -r B will give you

    A-B-C
    

    with your working copy set to B, any changes will result in branching from B (parent revision set to B)

    A-B-C
      \e
    

    revert -r B will give you

    A-B-C-b'
    

    where b' is a set of changes which undoes everything in the intermediate committed changes, in this case it undoes all of C. any changes now just join the b' set (parent revision left unchanged at C)

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