问题
I am attempting to migrate from a mercurial repository to a git repository using fast-export, but I am getting
Error: repository has at least one unnamed head: hg r491
回答1:
I wrote a plugin for fast-export that allows you to specify the divergent commit for an unnamed head along with a new branch name, and that entire line will be moved to that new branch.
/path/to/hg-fast-export.sh -r /path/to/hg_repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374
Until this is (hopefully) merged, the steps to take to use this plugin:
git clone https://github.com/ethanfurman/fast-export.git
cd fast-export
git checkout head2branch-plugin
mkdir /path/to/new-git-repo
cd /path/to/new-git-repo
git init
/path/to/fast-export/hg-fast-export.sh -r /path/to/hg_repo
At this point, research each unnamed head to find its first divergent commit, and a new branch name for it. For example:
$ /path/to/fast-export/hg-fast-export.sh -r ~/path/to/hg-repo
Error: repository has unnamed head: hg r491
Error: repository has unnamed head: hg r373
Finally, run fast-export
with the plugin active, specifying -f
to ignore the unnamed heads error:
$ /path/to/fast-export/hg-fast-export.sh -r /path/to/hg-repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374
来源:https://stackoverflow.com/questions/58862417/at-least-one-unnamed-head-error-when-converting-mercurial-repo-to-git-using-fast