首页 > 解决方案 > 使用 TortoiseHG 将 Mercurial 转换为 Git。没有文件被创建

问题描述

我想将 Mercurial 项目转换为 Git 项目。我正在使用 TortoiseHG遵循https://stackoverflow.com/a/34853438/984003的说明。

  1. 启用 hggit

  2. 打开命令行,输入一个空目录。

  3. git init --bare .git

  4. cd 到您的 Mercurial 存储库。

  5. hg 书签 hg

  6. hg push c:/path/to/your/git/repo

  7. 在 Git 目录中: git config --bool core.bare false

在推送命令之后,它说

添加了 5815 个提交,包含 24723 个树和 24178 个 blob

所以发生了一些事情。但是,当我转到 repo 目录(我推送到的路径)时,它是空的,除了 .git

标签: gitmercurialtortoisehg

解决方案


@zerkmas 在评论中是对的。

从 c:/path/to/your/git/repo,执行:

git checkout hg

然后所有文件都出现了。

编辑:最后,这对我也没有用。它失去了树枝。

我最终使用了 GitHub 的导入器:

将 Bitbucket Mercurial 存储库转换为 Git。维护分支和历史。在线解决方案


推荐阅读