Mercurial:如何恢复到特定版本?

发布于 2024-09-14 01:52:51 字数 599 浏览 4 评论 0原文

我正在实时服务器上工作。我已经更新到提示,但它引起了问题:我需要恢复到一切正常的特定变更集(388)。

我在服务器上没有任何值的更改,本地更改集根本不重要。事实上,我实际上想杀死任何本地意外更改或合并,以免造成混乱。

如何恢复到特定变更集并终止任何本地更改?这是否与以下内容有关:

hg revert 

---- 更新 ---

为了澄清,我想做的是首先将本地的所有内容恢复到变更集 388,然后确保我的本地存储库处于这样的状态:当我这样做

hg status

时没有输出。否则我有一种讨厌的感觉,当我下次拉提示时,将会有冲突需要处理 - 我想避免这种情况,因为局部更改没有价值。

---- 更新 ---

对于这种情况下的其他人来说,最终为我解决的问题是:

rm -rf <repo_dir>
hg clone http://repository
hg update -r 388

这将杀死所有本地更改,因此请谨慎操作(但这就是我在这种情况下想要的)。

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 changes of any value on the server, the local changeset does not matter at all. In fact I actually want to kill any local accidental changes or merges so as not to confuse things.

How do I revert to a particular changeset and kill any local changes? Is it something to do with:

hg revert 

---- UPDATE ---

To clarify, what I would like to do is first revert everything locally to changeset 388, and then ensure that my local repo is in such a state that when I do

hg status

I get no output. Otherwise I have a nasty feeling that when I next pull the tip, there will be conflicts to deal with - which I want to avoid, because the local changes are of no value.

---- UPDATE ---

For anyone else in this situation, what eventually fixed it for me was:

rm -rf <repo_dir>
hg clone http://repository
hg update -r 388

That will kill all your local changes, so proceed with caution (but that's what I wanted in this case).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜巴黎 2024-09-21 01:52:51

只需使用下面的命令即可进行修订。

hg revert -r REV

它与--all 相冲突。

要终止所有本地更改,--all 应该有效。

hg revert --all

不要使用回滚。这是一个不可逆转的过程,因此应小心使用。

编辑

您可以使用 --clean 选项进行更新。这将丢弃任何未提交的更改。
然后更新到一些变更集。

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.

逆蝶 2024-09-21 01:52:51
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

还有一个很棒的清除扩展。非常可靠的东西,它从工作目录中删除所有未跟踪的文件。

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.

陌路黄昏 2024-09-21 01:52:51

我不认为你真的很清楚你想要什么,但我的解释是 hg update -C -rev 388 但你同样可以在恢复之后,或者可能(不太可能)甚至回滚。我对这个问题的回答给出了更新和恢复之间的很大区别< /a>

您确实需要弄清楚您希望在工作副本中看到什么以及您希望历史状态如何在它们之间进行选择

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文