问题
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