使用 Mercurial,我需要在分支之前提交到主分支吗?
使用 Mercurial 存储库,在初始化它之后,我是否需要在创建另一个命名分支之前先提交到 master 分支,或者我可以这样做:
hg init
hg branch develop
然后提交到开发分支,然后在某个阶段将开发合并到主分支中。
With a mercurial repository, after initialising it, do I need to commit to the master branch first, before creating another named branch, or can I do:
hg init
hg branch develop
and then commit onto the develop branch, before at some stage merging develop into the master.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Mercurial 确实没有主分支的概念;它们都是平等的,并且所有 hg 变更集都属于一个且仅一个分支。有一个约定将初始分支命名为
default
,并且在创建新分支之前一直使用该名称,但您不需要使用该名称。在您的情况下,由于初始提交是对名为develop
的分支进行的,因此不存在其他分支名称,包括default
,直到您随后创建并提交一个分支。不使用分支命令:
使用
branch
命令:Mercurial really doesn't have the concept of a master branch; they are all equal and all hg changesets belong to one and only one branch. There is a convention of naming the initial branch as
default
and that name is used until you create a new branch, but you don't need to use that name. In your case, since the initial commit is made to a branch nameddevelop
, no other branch names exist, includingdefault
, until you subsequently create and commit one.Without using a branch command:
Using a
branch
command: