Ravyn
Ravyn

Reputation: 157

mercurial to git branch issue

I converted a mercurial repo into a git repo using following this site https://helgeklein.com/blog/2015/06/converting-mercurial-repositories-to-git-on-windows/.It did not mention that it would not copy all the branches. In the mercurial repo they were named branches but when I converted it a git they changed '.git\objects....', which they all seem to be from my develop branch, but I need my other branches in the repo. I need to know how do I go about adding the branches that is missing. I want to be able to add to the rest of it and I need to know if the link that I followed was the best course of action or if there is something missing to it. Any help on my problem would be great. I have tried also using fast-export but that did not work either. I am willing to try any other ideas if anyone can provide some course of action. I am using BitBucket as the site where my repo's reside.

Upvotes: 1

Views: 128

Answers (2)

Lazy Badger
Lazy Badger

Reputation: 97395

  1. Any posts from 2015 about Mercurial|HGGit are extremely outdated in a lot of areas (even more fresh topic /last edit Jan 8, 2020/ in Mercurial Wiki have some sections marked as "outdated") and probably best source will be readme from hggit repo
  2. If you can get working hggit in THG (it's hardest and most time-consuming part of work), interacting with Git will be rather straightforward
    • Every named branch of Mercurial must have linked bookmark to it in order to interoperate with Git-repo. You can add bookmarks by hand or use (released after for 2015 and thus not covered in article) branch_bookmark_suffix feature for auto-creating and auto-naming
    • Without handwork and patches of code you'll not be able to push to Git-repo over https if authentication is required on remote (and this /authentication/ is true for 99.99% of cases), easiest solution will be just move to git+ssh:// (if remote-side support it, obviously)

PS: I have and use local TortoiseHG 5.0.2+hggit for working with my Git-repo on GitHub, I can answer on any related questions more deeply, if needed

Upvotes: 0

arhak
arhak

Reputation: 2542

regretfully in Git there are no named branches, so the migration cannot come up with nothing like them

the migration should have created bookmarks instead, since Git's branches are more close to Mercurial's bookmarks than to actual "named branches"

you might be interested in reading https://felipec.wordpress.com/2011/01/16/mercurial-vs-git-its-all-in-the-branches/

notice that if you are used to Mercurial, likely you'd miss them for a while, but eventually you'll get use to "the git way" and you'll survive, I hope ;-)

Upvotes: 1

Related Questions