主要观点:长期使用 Mercurial 作为源代码控制系统,近期决定改用 Git,介绍了使用 hg-fast-export 将 Mercurial 仓库转换为 Git 的步骤。
关键信息:
- 已安装 Git 环境,未安装需前往https://git-scm.com/下载安装。
- 步骤包括下载 hg-fast-export、创建新 Git 仓库、可选配置 core.ignoreCase、执行 hg-fast-export、检出 HEAD、推送至 Git 仓库服务器端、复制未跟踪文件并更新.gitignore。
重要细节: - 下载 hg-fast-export:
git clone git://repo.or.cz/fast-export.git
- 创建新 Git 仓库:
mkdir new_git_repository
,cd new_git_repository
,git init
- 配置 core.ignoreCase:
git config core.ignoreCase false
(可选) - 执行 hg-fast-export:
/path/to/hg-fast-export.sh -r /path/to/hg_repo
- 检出 HEAD:
git checkout HEAD
- 推送至服务器:
git remote add origin git@my-git-server:my-repository.git
,git push -u origin master
- 复制未跟踪文件并更新.gitignore:后续操作以完成转换及相关更新。
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。