3

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?

gligoran
  • 3,267
  • 3
  • 32
  • 47

2 Answers2

5

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.

Christophe Muller
  • 4,850
  • 1
  • 23
  • 31
  • Thanks for the answer. I'm trying to do this, but it's a bit complicated as I already have a repository on Codeplex and I don't want to mess it up. But you did give me an idea with bookmarks. I'll report back if it goes through. – gligoran Dec 28 '10 at 14:29
  • Yeah, baby :) I've finally done it :) I've created bookmarks for my branches. For default I've added master as they advise you at http://hg-git.github.com/. I've also got a branch EFCodeFirst, but Hg won't let you have a bookmark with the same name. Luckily branches in Hg are case sensitive, so I've added a efcodefirst bookmark. Hg-Git then transformed this to git branches :) Thank you Christophe for the idea. – gligoran Dec 28 '10 at 14:52
  • Well Bravo then! well done. With the second repo on an hg server it was certainly not easy to handle.. :-). – Christophe Muller Dec 29 '10 at 06:05
0

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
kuri65536
  • 166
  • 2
  • 8