Mercurial:修正无聊的历史 [英] Mercurial: Fix a borked history
问题描述
所以最近(我自己-没有其他开发人员)在一个项目上工作,我设法以某种方式(显然是)从克隆的存储库中合并了错误的历史.
So working on a project recently (by myself - no other developers), I somehow managed to seriously bork the history with some (apparently) bad merges from cloned repositories.
我想做的-需要做的-通过仅删除最后8次提交(根据hg glog
)来解决此问题
What I would like to do - need to do - is fix this by just deleting the last 8 commits (according to hg glog
)
是的,在无聊开始之后,我对代码进行了一些更改,但是,在这里或那里仅进行了一些调整-没有什么我无法从内存中修复的.
Yes, I have made a few changes to the code after the borking began, however, only a few tweaks here or there - nothing I can't fix fresh from memory.
如何摆脱最近的8次提交并从混乱的地方重新开始?
推荐答案
克隆存储库-执行此操作时,您可以指定应该克隆的最后一次提交.
Make a clone of your repository - when you do this, you can specify the last commit that should be cloned.
因此,如果您的存储库中有100个变更集,而您想摆脱93到100个变更集,只需执行以下操作:
So, if your repository has 100 changesets and you want to get rid of changesets 93 to 100, just do this:
hg clone -r 92 BadRepository CleanRepository
-> CleanRepository
仅包含变更集1到92.
--> the CleanRepository
will only contain changesets 1 to 92.
如果使用TortoiseHG,则可以在克隆"对话框中执行相同的操作(有一个文本框克隆到修订版:")
If you use TortoiseHG, you can do the same in the Clone dialog (there is a textbox "Clone to revision:")
这篇关于Mercurial:修正无聊的历史的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!