简体   繁体   English

如何使用Git管理Kiln的分支机构?

[英]How to manage branches with Kiln using Git?

My company is using Kiln so developers can use their preferred tool between Git and Mercurial. 我的公司正在使用Kiln,因此开发人员可以在Git和Mercurial之间使用他们的首选工具。 I'm a Git user and never used Mercurial. 我是Git用户,从未使用过Mercurial。

There are some incomprehensions in the use of branches with Kiln. 使用窑的分支有一些不足之处。 When I create a new branch using the Kiln interface, it, in reality, creates a new repository, not a branch. 当我使用Kiln接口创建一个新分支时,它实际上会创建一个新的存储库,而不是一个分支。 Even if Kiln displays it as a "branch" and not a "repository". 即使Kiln将其显示为“分支”而不是“存储库”。 And when I clone the repository in Git, git branch -a does not show me the remote branch I just created. 当我在Git中克隆存储库时, git branch -a不会向我显示我刚刚创建的远程分支。 I need to clone every pseudo-branch independently. 我需要独立克隆每个伪分支。

On the other side, if I create a branch in Git and push it to the remote, it does not create a branch on Kiln but some kind of "sub-branch" called a "head" visible in all branches. 另一方面,如果我在Git中创建一个分支并将其推送到远程,它不会在Kiln上创建分支,但在所有分支中都会显示某种称为“head”的“子分支”。 Very confusing. 非常混淆。 But there is apparently no way to create these "sub-branch" that work perfectly with Git via the Kiln interface. 但显然没有办法创建这些通过Kiln界面与Git完美配合的“子分支”。 I also don't know if they work well on Mercurial. 我也不知道他们是否在Mercurial上运作良好。

$ git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/feature2
  remotes/origin/master

I'm convinced this is related to the pro-Mercurial "philosophy" of Kiln. 我确信这与窑的亲Mercurial“哲学”有关。 I made some researches on Mercurial and find out that the branch system is completely different from Git. 我对Mercurial进行了一些研究,发现分支系统与Git完全不同。 It is normal to clone the repository to create a branch while in Git it is non-sense. 克隆存储库以创建分支是正常的,而在Git中它是无意义的。 Mercurial has also "named branches" which cannot be deleted and their use is discouraged by the Kiln developers. Mercurial还“命名分支”,不能删除,并且窑开发人员不鼓励使用它们。 Can my "sub-branches" be actually "named branches"? 我的“支行”能否真正成为“命名分支”? The problem is that I can delete those "sub-branches" using git push origin :sub-branch . 问题是我可以使用git push origin :sub-branch删除那些“子分支”。

The answer must be obvious since branching is an important features of both Mercurial and Git and Kiln must have done a simple and elegant way of doing branch working using both tools. 答案必须明显,因为分支是Mercurial和Git的重要特征,而Kiln必须使用这两种工具完成一个简单而优雅的分支工作方式。 But I'm unable to figure out the logic of Kiln. 但我无法弄清楚窑的逻辑。 I'm afraid Kiln may be too Mercurial-friendly and that the Git support may be more like a hack. 我担心Kiln可能对Mercurial友好,并且Git支持可能更像是一个hack。

On the Kiln UI, when you create a branch, it is a "clone branch", not a Mercurial named branch. 在Kiln UI上,当您创建分支时,它是“克隆分支”,而不是Mercurial命名分支。

If you use named branches in Mercurial, they will be automatically translated to Git branches. 如果在Mercurial中使用命名分支,它们将自动转换为Git分支。 However, when you commit to the Git branch it will not convert back to the same named branch in Mercurial. 但是,当您提交Git分支时,它将不会转换回Mercurial中的同一个命名分支。 The Kiln Team had to figure out the best analogue for the Git-to-Mercurial translation of Git branches, and they decided that a Mercurial 'bookmark' works the best. Kiln团队必须找出Git分支的Git-to-Mercurial翻译的最佳模拟,他们认为Mercurial的“书签”效果最佳。 So when you push to a Git branch it will update or create a corresponding Mercurial bookmark ( https://www.mercurial-scm.org/Bookmarks , http://mercurial.aragost.com/kick-start/en/bookmarks/ ) with the same Git branch name, and that bookmark will be on the 'default' branch in Mercurial. 所以,当你推到一个Git分支,它会更新或创建一个相应的水银书签( https://www.mercurial-scm.org/Bookmarkshttp://mercurial.aragost.com/kick-start/en/bookmarks/ )具有相同的Git分支名称,该书签将位于Mercurial中的“默认”分支上。 I'd check with the members of your team that use Mercurial to see if using bookmarks as an analogue to Git branches would work for them. 我会与团队中使用Mercurial的成员核实,看看使用书签作为Git分支的类似物是否适用于他们。

Another option would be to try and see if your team likes the Kiln UI's "clone branch" to maintain separate lines of development versus using the named branch approach. 另一个选择是尝试查看您的团队是否喜欢Kiln UI的“克隆分支”来维护单独的开发线,而不是使用命名分支方法。

The team at Kiln has addressed how to merge repositories in the following post. Kiln团队在下面的文章中讨论了如何合并存储库。 This should get you the info you need in order to merge your Kiln branch/repository. 这将为您提供合并Kiln分支/存储库所需的信息。 Essentially you are doing a pull then push from one repository to another. 从本质上讲,你正在做一个拉动,然后从一个存储库推送到另一个

Kiln Branch\\Repository Merging Kiln Branch \\ Repository Merging

While git doesn't seem to have what ever the branching issues are that one would typically hear about in hg; 虽然git似乎没有人们通常会听到的关于hg的分支问题; Joel Spolsky has stated that the decision to favor hg over git came out of a statement/policy made by Linus Torvalds to not do anything in git that favors windows users. Joel Spolsky表示,支持hg over git的决定来自Linus Torvalds的一项声明/政策,该声明/政策没有采取任何有利于Windows用户的git。 Joel addressed this in a presentation on FogBugz and Kiln in 2011. You can listen to the remark at minute 40:40 in the following video. Joel在2011年关于FogBugz和Kiln的演讲中对此进行了阐述。您可以在下面的视频中分40:40收听评论。

Joel Spolsky on Mercurial Choice Joel Spolsky关于Mercurial Choice

Back in 2011 one might have agreed with the Mercurial decision made by Fog Creek but things have clearly advanced in the world of git and adoption of git is obviously heavy enough to persuade Fog Creek to create Kiln Harmony which allows either hg or git use. 早在2011年,人们可能已经同意Fog Creek的Mercurial决定,但是git世界中的事情已经明显发展,git的采用显然足以说服Fog Creek创建Kiln Harmony,允许使用hg或git。

Kiln Harmony 窑和谐

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM