在 Mercurial 中管理长期存在的命名分支
所以我在我的一个项目中使用 Mercurial,我是唯一的开发人员。 我通常使用默认分支进行实际开发,我使用一些短期分支来实现新功能,这很好:我创建它们,编写新功能,如果它工作得足够好,我会将该分支合并到默认分支中,并且永远不会再次使用它。 但我想在不同的分支中编写文档,因为我真的不想用文档提交“污染”默认分支。
在我为默认分支中的内容编写了足够的文档后,我将 docs 分支合并到主分支中。但过了一段时间,我想再次使用 docs 分支,并且我必须从主分支中提取更改,或者创建另一个新分支。
处理这个问题的最佳工作流程是什么?我的方法完全错误吗?
So I'm using mercurial for a project of mine, I'm the only developer.
I usually use the default branch for actual developing, I use some short lived branches for new-features, and that's fine: I create them, write the new feature and if it works good enough, I merge that branch in the default branch and never use it again.
But I'd like to write documentation in a different branch, since I don't really want to "pollute" the default branch with docs commits.
After I have written enough documentation for the stuff I have in the default branch I merge the docs
branch in the main one. BUT after a while I'd like to use the docs
branch again, and I have to pull the changes from the main one, or create another new branch.
What's the best workflow to deal with this? Is my approach entirely wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将文档放在源代码管理中有点奇怪。如果文档是二进制的 (.doc/.docx/.xlsx),Hg 将无法合并它们。如果您存储 .html、.xml 或某些纯文本格式,那么它的效果会稍好一些。有一些开源系统允许您使用 Hg 并提供单独的文档管理(例如 Redmine) )
假设您刚刚将
docs
合并到default
中,您可以通过执行以下操作继续使用docs
分支:通过合并
default 到
docs
中,您正在制作确保docs
包含default
上存在的所有更改。对docs
执行后续提交将有效地允许您继续在该分支上工作。另一种说法是,合并在 Hg 中是定向的 - 如果您希望docs
与default
保持同步,则必须显式执行该合并。Placing documents in source control is a little bit strange. If the documents are binary (.doc/.docx/.xlsx), Hg will not be able to merge them. If you're storing .html, .xml, or some plain text format then it will do a slightly better job. There are a few open source systems that will allow you to use Hg and provide separate document management (Redmine, for one)
Assuming you've just merged
docs
intodefault
you can continue using thedocs
branch by doing this:By merging
default
intodocs
, you're making sure thatdocs
has all changes that existed ondefault
. Performing a subsequent commit ondocs
will effectively allow you to continue working on that branch. Another way to say this is that merging is directional in Hg - if you wantdocs
to be up to date withdefault
, you've got to perform that merge explicitly.要从与原始文档分支合并的子分支再次开始使用文档分支,只需将工作副本更改为该分支并提交即可。
如果您对 docs 分支有更改,那么您需要先合并,然后才能提交。
To start using the docs branch again from a child of your merge with the original docs branch, simply change your working copy to the branch and commit to it.
If you have changes on the docs branch then you need to merge before you can commit.