将Mercurial项目转换为Git [英] Convert Mercurial project to Git

查看:108
本文介绍了将Mercurial项目转换为Git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将一个mercurial项目转换为一个git项目,但我想保持提交历史不变。我目前的解决方案是只删除hg相关的文件,然后git init&&手动添加我需要的文件,但这不会保留历史记录。有没有解决这个问题的方法? 解决方案

您可以尝试使用 fast-export

  cd〜
git clone https://github.com/frej/fast-export.git
git init git_repo
cd git_repo
〜/ fast-export / hg-fast -export.sh -r / path / to / old / mercurial_repo
git checkout HEAD

也请看这个SO问题


I need to convert a mercurial project to a git project, but I would like to keep the commit history intact. My current solution was to just remove hg related files and then git init && add manually the files I needed, but that would not keep the history. Are there any solutions to this?

解决方案

You can try using fast-export:

cd ~
git clone https://github.com/frej/fast-export.git
git init git_repo
cd git_repo
~/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo
git checkout HEAD

Also have a look at this SO question.

这篇关于将Mercurial项目转换为Git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆