Discard all and get clean copy of latest revision?

后端 未结 5 2089
Happy的楠姐
Happy的楠姐 2021-01-29 19:21

I\'m moving a build process to use mercurial and want to get the working directory back to the state of the tip revision. Earlier runs of the build process will have modified so

5条回答
  •  礼貌的吻别
    2021-01-29 19:47

    Those steps should be able to be shortened down to:

    hg pull
    hg update -r MY_BRANCH -C
    

    The -C flag tells the update command to discard all local changes before updating.

    However, this might still leave untracked files in your repository. It sounds like you want to get rid of those as well, so I would use the purge extension for that:

    hg pull
    hg update -r MY_BRANCH -C
    hg purge
    

    In any case, there is no single one command you can ask Mercurial to perform that will do everything you want here, except if you change the process to that "full clone" method that you say you can't do.

提交回复
热议问题