Mercurial:如何恢复到特定版本?
我正在实时服务器上工作。我已经更新到提示,但它引起了问题:我需要恢复到一切正常的特定变更集(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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
只需使用下面的命令即可进行修订。
它与--all 相冲突。
要终止所有本地更改,--all 应该有效。
不要使用
回滚
。这是一个不可逆转的过程,因此应小心使用。编辑
您可以使用 --clean 选项进行更新。这将丢弃任何未提交的更改。
然后更新到一些变更集。
Just use the command below, to get to a revision.
It's conflicting with --all.
To kill all local changes, --all should work.
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.
还有一个很棒的清除扩展。非常可靠的东西,它从工作目录中删除所有未跟踪的文件。
There is also a wonderful Purge extension. Very solid stuff, it deletes all untracked files from working directory.
我不认为你真的很清楚你想要什么,但我的解释是
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 revertyou 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