Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import HG bookmarks to Git branches #61

Open
tobia opened this issue Feb 8, 2016 · 5 comments
Open

Import HG bookmarks to Git branches #61

tobia opened this issue Feb 8, 2016 · 5 comments
Labels
contribution-required Maintainer has no time and/or no plans to work on this, interested parties should submit a patch feature-request This is a feature request

Comments

@tobia
Copy link

tobia commented Feb 8, 2016

HG bookmarks are effectively the same thing as Git feature branches, while HG branches are a very different beast, much less useful IMHO.

Therefore it would be useful if fast-export converted HG bookmarks → Git branches, instead of failing with an error:

Error: repository has at least one unnamed head: hg r779
@frej
Copy link
Owner

frej commented Feb 12, 2016 via email

@atifaziz
Copy link

atifaziz commented Mar 3, 2016

👍 Hg bookmarks is the right call here

@allenwyma
Copy link

not using HG to begin with is the real answer :D damn unnamed heads!

@frej frej added the feature-request This is a feature request label Nov 4, 2016
@frej frej added the contribution-required Maintainer has no time and/or no plans to work on this, interested parties should submit a patch label Sep 1, 2019
@tobia
Copy link
Author

tobia commented Oct 23, 2019

Here's a workaround to import such a repository.

For each unnamed head, or maybe for each bookmark (hg bookmarks) create a HG branch with the same name:

hg checkout SomeBookmark
hg branch SomeBookmark
touch .delete_me
hg commit -m SomeBookmark

This should be done on the HG repository before trying to import it into Git. You need to change something and make a commit for the new branch to be visible.

@chrisjbillington
Copy link
Contributor

You don't need to add a new commit or a new file. You can amend the commit to change the branch it's on:

hg update SomeBookmark
hg branch SomeBookmark
hg commit --amend -m "$(hg log -r SomeBookmark --template '{desc}')"

The -m argument is just to copy the commit message from the existing one - if you're interactive you can omit it and just dismiss the editor when it pops up to keep the commit message.

This is a bit cleaner! On the git end it will just look like the branch was always a named branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution-required Maintainer has no time and/or no plans to work on this, interested parties should submit a patch feature-request This is a feature request
Projects
None yet
Development

No branches or pull requests

5 participants