从Mercurial迁移到Git [英] Migrating from Mercurial to Git

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

问题描述

我知道这个问题在几次之前问过,并且标记为可能的重复,但他们中没有一个看起来工作正确。我试过快速导出,它给出了错误。任何人都可以帮助如何从Mercurial迁移到Git?我需要历史。如果它是一步一步列出的,我们将不胜感激。

更新:

我试过快速导出:

  cd〜
git clone git://repo.or.cz/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

这会给出错误:



..... hg-fast-export.sh:第79行:python:command not found

感谢您的帮助!

解决方案


  • 将hg-git添加到Mercurial中
  • 推送hg-repo到git-target



    分步指南



    从 Github上的回购



    I know this question asked before several times and marked "possible duplicate", but none of them seems working correct. I tried fast-export and it gives error. Could anyone help How to migrate from Mercurial to Git? I need the history. It would be appreciated if it is listed step by step.

    UPDATE:

    I tried fast export:

    cd ~
    git clone git://repo.or.cz/fast-export.git
    git init git_repo
    cd git_repo
    ~/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo **[I get error in this line]**
    git checkout HEAD
    

    this gives error:

    ..... hg-fast-export.sh: line 79: python: command not found

    Thanks for the help!

    解决方案

    1. Add hg-git to Mercurial
    2. Push hg-repo to git-target

    Step-by-step Guide

    A Clone Hg-Git Extension from it's repository into some local PATH\TO\HG-GIT

    B Enable extension in (global mercurial.ini or repository's-specific .hgrc)

    [extensions]
    bookmarks = 
    ...
    hggit = PATH\TO\HG-GIT
    

    bookmark was added long time ago, when this extension wasn't part of TortoiseHG|Mercurial, not sure about today's configuration

    C Create new Git-repository with read|write access to it (or remeber existing?!)

    D Add Git-repo from p. C into [paths] section of .hgrc for Mercurial repository, which you want to export in Git under any name. Sample for my local Mercurial repository, which have Git-mirror on Github

    [paths]
    default = git+ssh://git@github.com/lazybadger/Fiver-l10n.git
    

    E After it you can use Git-repository as usual remote repository in Mercurial and, as fist operation (for created empty Git-repository) you have to push to your new remote

    F Check existence of Git-repository with full history from Mercurial mirrored into it after push

    G Use Git-repository by usual way

    Sources, used in this guide

    • Local Mercurial repository of WP-theme with very easy linear history

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

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