我正在尝试使用 fast-export
从 mercurial 存储库迁移到 git 存储库, 但我得到了
Error: repository has at least one unnamed head: hg r491
最佳答案
更新
以下代码由 ondrej-stanek-ozobot 增强,并于 2020 年 7 月 31 日 merge 到 fast-export
中。
原始答案
我写了一个plugin for fast-export
这允许您为未命名的头部指定发散提交以及新分支名称,并且整行将移动到该新分支。
/path/to/hg-fast-export.sh -r /path/to/hg_repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374
在(希望) merge 之前,使用此插件的步骤:
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
此时,研究每个未命名的 head 以找到它的第一个分歧提交,以及一个新的分支名称。例如:
$ /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
最后,在插件激活的情况下运行fast-export
,指定-f
忽略未命名的磁头错误:
$ /path/to/fast-export/hg-fast-export.sh -r /path/to/hg-repo -f --plugin head2branch=aliases,373 --plugin head2branch=threads,374
关于git - 使用快速导出将 mercurial repo 转换为 git 时至少出现一个未命名的头部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58862417/