Mercurial 中的小型临时分支
我已经阅读了很多有关 Mercurial 及其分支的内容,但是,我仍然是一个版本控制新手。
我目前正在开发一个项目,我的任务是开发一个新模块。
我有一个“主”存储库,其中包含项目其余部分的最新代码,以及一个克隆存储库(称为“任务”),我现在正在其中进行工作。
我对我的任务进行了一系列的提交,并发现我想用我的程序读取/存储/处理配置数据的方式做一些“实验”。
现在,如果我正确理解了 VC 最佳实践,这将是一个分支的好时机。
如果我开始这个实验,并且我喜欢它的发展方向,我会想很快地将它合并回“默认”分支上的“任务”存储库。
另一方面,如果我不喜欢它的进展,我可能会废弃该分支。
我最舒服的分支方式是通过克隆,但是我不认为这在这种情况下是最好的方法,因为我只会更改几个文件,但显然使用命名分支是永久性的,这并不在这里似乎也合适。
对于这种情况,您的建议/最佳实践是什么?
I've read a lot about Mercurial and branching in it, however, I am still very much a version control newbie.
I'm currently working on a project, where I have been tasked to work on a new module.
I have a "main" repository, which contains the latest code from the rest of the project, and a cloned repository (call it "task") where I am doing my work now.
I am a bunch of commits into my task, and find that I would like to do a little "experiment" with the way my program reads/stores/handles configuration data.
Now, if I understand VC best-practices correctly, this would be a great time to branch.
If I start into this experiment, and I like where it's going, I will want to merge it back into my "task" repository on the "default" branch pretty quickly.
On the other hand, if I don't like how it's going, I'll probably just scrap the branch.
The way I am most comfortable branching is through cloning, however I don't think this would be the best approach in this situation, as I'll only be changing a few files, but apparently using named branches is permanent, which doesn't seem appropriate here either.
What is your advice / best practice for this kind of situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对 Mercurial 比较陌生,但我确切地知道您所描述的情况。我之前对此做了一些研究,我的结论是最简单的方法是克隆我的存储库。
请参阅此答案了解更多信息。
另外,这是一个很棒的 Mercurial 分支指南:)
I'm relatively new to Mercurial, but I know exactly the situation you are describing. I did some research on this before, and my conclusion was that the easiest way was to clone my repository.
See this answer for some more insight.
Also, this is a great guide to branching in Mercurial :)
毫无疑问,选择克隆。 Mercurial 中的命名分支甚至连 Mercurial 人员也说您并不经常需要。 DVCS 的优点之一是,您可以轻松克隆存储库并尝试一些新的和不同的东西,如果它们有效,那就太好了,将其合并回主存储库,否则,将其全部删除。
我个人在 Mercurial 中使用“按功能分支”方法,这意味着我将为我正在开发的每个功能创建我的主要存储库的克隆。这包括尖峰和实验。
Go with a clone, no doubt about it. A named branch in Mercurial is something that even the Mercurial folks say you don't need all that often. One of the beautiful things about DVCS is the fact that you can easily clone the repo and try some new and different things, and if they work, great, merge it back in to the main repo, otherwise, delete it all.
I personally use a "Branch By Feature" approach with Mercurial, which means that I will make a clone of my primary repo for each feature I'm working on. This includes spikes and experiments.