问题
My company is using Kiln so developers can use their preferred tool between Git and Mercurial. I’m a Git user and never used 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. Even if Kiln displays it as a "branch" and not a "repository". And when I clone the repository in Git, git branch -a
does not show me the remote branch I just created. 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. Very confusing. But there is apparently no way to create these "sub-branch" that work perfectly with Git via the Kiln interface. I also don't know if they work well on 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. I made some researches on Mercurial and find out that the branch system is completely different from Git. It is normal to clone the repository to create a branch while in Git it is non-sense. Mercurial has also "named branches" which cannot be deleted and their use is discouraged by the Kiln developers. Can my "sub-branches" be actually "named branches"? The problem is that I can delete those "sub-branches" using 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. 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.
回答1:
The team at Kiln has addressed how to merge repositories in the following post. This should get you the info you need in order to merge your Kiln branch/repository. Essentially you are doing a pull then push from one repository to another.
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; 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 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 Spolsky on 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.
Kiln Harmony
回答2:
On the Kiln UI, when you create a branch, it is a "clone branch", not a Mercurial named branch.
If you use named branches in Mercurial, they will be automatically translated to Git branches. However, when you commit to the Git branch it will not convert back to the same named branch in 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. 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. 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.
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.
来源:https://stackoverflow.com/questions/18586534/how-to-manage-branches-with-kiln-using-git