Commiting Mercurial (Hg) branch to GitHub

半世苍凉 提交于 2019-12-06 08:17:01

问题


I have a little project project called MvcOpenId. I host the source for this on both Codeplex and GitHub. Localy I'm using Mercurial (Hg) for version control and then with the hg-git plugin I'm pushing to both online repositories. This has been working well until now. I've added a branch to my Mercurial (Hg) repository. The push to Codeplex went smooth, but the push to GitHub not so much. GitHub repository does not show any branches and only the branch commits have been pushed.

How can I push my whole Mercurial (Hg) repository to GitHub including all the branches and everything?


回答1:


I have been noticing that git branches are well imported then re-exported by hg-git, but in the form of bookmarks. It might not be very user-friendly for you but could you try the following:

  • first git clone your existing github repo,
  • then make a new (git) branch, then commit and push,
  • finally clone the github repo into hg using hg-git

After these steps you should see your new git branch in hg (in the list of bookmarks). You can work on it in a classical way: hg update -C <name> then commit. And when you push a changeset related to this bookmark, hg-git should add a new changeset to the corresponding git branch on github.

I know it's a bit cumbersome.. but it might help you nevertheless.

Cheers,
Christophe.




回答2:


In hggit 0.8, I can just use bookmark and push it into github.

hg clone git://github.com/some/project
cd project
hg bookmark new-branch

...work something...

hg commit
hg push git+ssh://git@github.com/some/project


来源:https://stackoverflow.com/questions/4531493/commiting-mercurial-hg-branch-to-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!