将代码从 Mercurial 移动到 Bitbucket

Move code from Mercurial to Bitbucket

目前,我在 Kiln 服务器中使用 Mercurial 作为我的版本控制。我想使用 Git 将我的代码迁移到 Bitbucket 服务器。我已经尝试了 Bitbucket 中可用的 import 选项,但我只能作为 Mercurial 存储库导入。

有什么方法可以实现吗?

您可能需要在自己的机器上使用 fast-export.

等工具进行 Mercurial -> Git 转换

然后您在 Bitbucket 上创建一个新的存储库并按照说明将您的项目推送到它。你不应该遇到任何重大障碍。

This answer 将为您提供有关如何操作的更多信息。

除了快速导出工具,还有一种将 Hg 迁移到 git 的简单方法:

初始化本地 git 存储库

mkdir git
cd git
git init 

克隆 hg 存储库

cd ..
hg clone <URL for hg_repo>
cd <hg_repo>
hg bookmarks hg
hg push ../git

从本地 git 存储库中的 hg 存储库获取更改

cd ../git
git checkout hg

在 bitbucket 上创建一个空的 git 存储库,并将本地 git 存储库推送到它

git remote add origin <URL for bitbucket repo>
git push -u origin hg

我对 git-remote-hg 有非常积极的体验。