Mercurial 中过去的分支
我是一名使用 Mercurial 来创建程序的单一开发人员。 到目前为止,我已经致力于开发的每一步,但我已经把事情搞砸了,想要做其他的事情。
我该如何转到以前的状态(即回滚),然后创建一个分支,维护较新的状态?
回滚会删除任何东西吗? 这就是我所做的一切吗? 只是回滚直到我到达我想要的位置,编辑,然后提交? 我稍后能够合并变更集,或者至少查看它们吗? 当然,我可以保存这个存储库,回滚,然后创建新的变更集,然后合并两个存储库?
我是 SCM 的新手,当然还有 DSCM,所以要温柔一点:)
I'm a single developer using Mercurial to create a program. I have so far committed at every step of developing, and I have messed things up and want to work on something else.
How shall I go to a previous state (ie. rollback) and then create a branch, maintaining the newer states?
Does rollback ever delete anything? Should that be all I do? Just rollback untill I'm at the place where I want, edit, then commit? Will I be able to merge the changesets later, or at least look at them? Of course I can just save this repository, rollback, and then create new changesets, then merge the two repositories?
I'm new to SCM and of course DSCM, so be gentle :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不想使用
hg rollback
,它只会删除恰好一个更改(最新的)。 请参阅您只能回滚一次汞书。要从较早的修订版创建分支,您需要找到要从中分支的修订版号并运行:
然后您可以在新克隆的存储库中进行更改(该存储库将不包含修订版之后的任何历史记录)您指定的编号),然后根据需要将这些更改合并回原始版本。
You don't want to use
hg rollback
, that only erases exactly one change (the most recent). See You Can Only Roll Back Once in the hg book.To make a branch from an earlier revision, you need to find the revision number you want to branch from and run:
You can then do your changes in the newly-cloned repository (which will not contain any of the history that came after the revision number you specified) and then merge those changes back into the original later, if you wish.
其他答案会起作用,但太过分了。 您需要做的就是:
您的本地工作文件夹将更新为指定版本的文件状态。 您可以从那里开始工作。
一旦您提交,它就会自动创建一个匿名分支。 您的原始提交仍然保留,但不妨碍您。
这是我建议开始的最简单的方法(恕我直言)。
The other answer will work but it is excessive. All you need to do is:
and your local working folder will be updated to the state of files at the specified revision. You can just work from there.
As soon as you commit it will create an anonymous branch automatically. Your original commits remain preserved but out of your way.
This is the simplest possible approach (IMHO) which I would recommend starting with.