English 中文(简体)
在Mercurial中,头部和分支之间有什么区别?
原标题:In Mercurial, what s the difference between a head and a branch ?

我是Mercurial和DVCS的新手。分支之间有什么区别?

最佳回答

如果你把它看作一棵树,那么头就是一片叶子,就在树枝的尽头。

It s explained really well at Mercurial s own wiki:
Branches
Heads

问题回答

答案是“视情况而定”。Mercurial有四种不同的分支策略,你可以从中选择,根据你选择如何称呼分支,答案可以是从“它们不相关”到“它们是一样的”。

首先查看四种类型的分支

  1. named branches
  2. bookmarks as branches
  3. anonymous branches
  4. clones as branches

如果你不清楚其中的任何一个,请点击链接。

然后看看每一个,让我们看看分支是如何相关的:

  1. named branches - completely unrelated. you can have multiple heads per named branch, and not every named branch needs to have a head
  2. bookmarks as branches - mostly unrelated. bookmarks can point to heads or non heads, but they move to the "new head" when you commit
  3. anonymous branches - heads are branches in this model. They re unnamed and very light.
  4. clones as branches - heads are branches, but you re more likely to have them in separate repos than in the same repo. You pull/push and then merge down to one in that repo.

TL;DR:你需要了解头部和分支才能很好地使用DVCS。

wiki

没有子项的变更集

分支具有相同分支名称的所有变更集的集合

每个变更集都属于一个分支,如果未指定,则默认

如果您是新手,正在寻找快速入门,我建议您hginit.com

很难指出差异,因为这些都是正交的概念。它们在Mercurial wiki中进行了解释





相关问题
bzr init-repo and multiple projects

I m having difficulties understanding bzr init-repo. I have 3 projects that I want to have in their own isolated repository, in subversion I would use svnadmin create three times to create them. Like ...

How suitable is a DVCS for the corporate environment?

I ve been using SVN for some time now, and am pretty happy with how it works (but I can t say I m an expert, and I haven t really done much with branches and merging). However an opportunity has ...

Renaming directories with the Fossil DVCS

Is it possible to rename directories with Fossil? I ve tried the obvious command: fossil mv oldname newname Fossil then informs me that it has done something: RENAME oldname newname However, ...

Distributed source control for VisualWorks Smalltalk

One of the annoying things about Smalltalk is that it (usually) requires its own VCS, due to the way that it manages its source code. Squeak and Gemstone (at least in its GLASS version) have a DVCS ...

Can I clone part of a Mercurial repository?

Is it possible to clone part of a Mercurial repository? Let s say the repository is quite large, or contains multiple projects, or multiple branches. Can I clone only part of the repository? E.g. in ...

How does git track source code moved between files?

Apparently, when you move a function from one source code file to another, the git revision log (for the new file) can show you where that code fragment was originally coming from (see for example the ...

热门标签