全部舍弃并获得最新修订的干净副本? [英] Discard all and get clean copy of latest revision?

查看:100
本文介绍了全部舍弃并获得最新修订的干净副本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在移动一个使用Mercurial的构建过程,并希望将工作目录恢复到最新修订的状态.在构建过程的早期运行中,将修改一些文件并添加了一些我不想提交的文件,因此我具有本地更改和未添加到存储库的文件.

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 some files and added some files that I don't want to commit, so I have local changes and files that aren't added to the repository.

丢弃所有内容并获得具有最新修订的干净工作目录的最简单方法是什么?

What's the easiest way to discard all that and get a clean working directory that has the latest revision?

当前我正在这样做:

hg revert --all
<build command here to delete the contents of the working directory, except the .hg folder.>
hg pull
hg update -r MY_BRANCH

但是似乎应该有一个更简单的方法.

but it seems like there should be a simpler way.

我想做的事情等同于删除存储库,进行新的克隆和更新.但是仓库太大,以至于不够快.

I want to do the equivalent of deleting the repo, doing a fresh clone, and an update. But the repo is too big for that to be fast enough.

推荐答案

这些步骤应该可以缩短为:

hg pull
hg update -r MY_BRANCH -C

-C标志告诉更新命令在更新之前放弃所有本地更改.

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

但是,这可能仍会将未跟踪的文件保留在存储库中.听起来您也想摆脱这些限制,所以我将使用purge扩展名:

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

在任何情况下,没有一个命令可以要求Mercurial执行,该命令可以完成您想要的所有操作,除非您将流程更改为您无法做到的完全克隆"方法.

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.

这篇关于全部舍弃并获得最新修订的干净副本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆