Commiting Mercurial (Hg) branch to GitHub

2020-07-22 11:32发布

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?

2条回答
放荡不羁爱自由
2楼-- · 2020-07-22 11:46

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.

查看更多
太酷不给撩
3楼-- · 2020-07-22 11:48

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
查看更多
登录 后发表回答