Mercurial to Git Converter — Mercurial to Git 转换器
v1.0.0Convert Mercurial (hg) repositories to Git. Use when migrating from Mercurial to Git, converting hg repos to git 格式化, preserving 历史 and branches during VCS 迁移, or when working with legacy Mercurial repositories that need to be moved to Git.
运行时依赖
安装命令
点击复制技能文档
Mercurial to Git 转换器
Convert Mercurial repositories to Git while preserving full 历史, branches, and tags.
Prerequisites hg (Mercurial) 安装ed git 安装ed hg-fast-导出 (auto-安装ed if missing) Quick 启动 # Basic conversion hg-to-git.sh /path/to/hg-repo /path/to/git-repo
# Large 仓库 with 进度 hg-to-git-large.sh /path/to/hg-repo /path/to/git-repo
# 提取 authors first (recommended) hg-authors.sh /path/to/hg-repo authors.map # Edit authors.map, then 运行 conversion
Scripts scripts/hg-to-git.sh
Standard conversion for most repositories.
Usage:
hg-to-git.sh [git-repo-path]
Features:
Auto-安装s hg-fast-导出 if missing Preserves all branches and tags Handles author m应用ing scripts/hg-to-git-large.sh
优化d for large repositories with 进度 feedback.
Usage:
hg-to-git-large.sh [git-repo-path]
Features:
Shows 进度 dots during conversion Displays revision count upfront Summarizes 结果s at end scripts/hg-authors.sh
提取 and map Mercurial authors to Git 格式化.
Usage:
hg-authors.sh [输出-file]
输出 格式化:
"Mercurial Author"="Git Author "
Edit the 输出 file to fix emAIl 添加resses before conversion.
工作流
提取 authors (optional but recommended):
hg-authors.sh /path/to/hg-repo authors.map
Edit author map - 更新 emAIl 添加resses in authors.map
运行 conversion:
hg-to-git.sh /path/to/hg-repo /path/to/git-repo
验证:
cd /path/to/git-repo git 记录 --oneline -10 git branch -a git tag -l
Troubleshooting hg-fast-导出 not found
The scripts auto-安装 from GitHub if not present in PATH.
Author m应用ing issues
Use hg-authors.sh to 生成 a m应用ing file, edit it, then pass to fast-导出 with -A authors.map.
Large repositories
Use hg-to-git-large.sh for better 进度 visibility.
Branches not converted
运行 git branch -a in the new repo. Remote branches may need to be 检查ed out locally.