将凌乱的svn仓库转换为git [英] converting messy svn repository to git

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

问题描述

我试图将一个稍微凌乱的svn仓库转换成git。我尝试阅读一些指南和其他SO问题,但在遵循什么是最好的方法时会有点失落。

SVN存储库具有顶级文件夹结构,文件夹,如:

  |  - 客户端
| - 服务器
| - 网站
| - misc

大多数这些文件夹都具有'标准'svn结构:即 trunk 分支标签

  |  -  client 
| - trunk
| - branches
| - 标记
| - 服务器
| - trunk
| - 分支
| - 标记
| - 网站
| - 其他

分支和标签可能在不同文件夹之间具有相同的名称。例如,客户端和服务器文件夹都可能有一个名为 1.0 的分支。



我设法使用个别文件夹 svn2git ,它似乎可以获得历史以及分支机构的罚款。我可以设法为每个文件夹创建一个单独的git存储库。然而,我想最终将所有内容保存在一个存储库中。



什么是将这些文件夹(现在称为git存储库)合并到一个,同时维护每个文件夹的分支,标签和历史记录?使用这种方法,我似乎失去了提交历史记录以及来自合并存储库的分支...或者, m只是缺少一些重要的步骤或做错了什么?



否则,可能在每个文件夹上单独使用 svn2git 最好的方法从svn迁移到git?

/ b
$ b
    $ / $> b $ b
  • 为svn仓库中的每个子文件夹创建一个git项目(使用svn2git)
  • 创建一个将所有仓库合并到一起的新git仓库
  • 将每个项目(包括所有分支)添加为远程:

      git remote add alpha< url /路径到-α-回购> 
    git remote add bravo< url / path-to-bravo-repo>
    git remote add charlie< url / path-to-charlie-repo>
    for $ in $(git remote);做
    git config remote。$ r.fetch \
    $(git config remote。$ r.fetch | sed -e's.remotes.heads / all。')
    git config --add remote。$ r.fetch \
    $(git config remote。$ r.fetch | sed -e's.heads.tags.g')
    git config remote 。$ r.tagopt --no-tags
    完成
    git远程更新


  • 将合并资源库推送到远程资源库(从现在起,这将是'官方'资源库)。

  • I am trying to convert a slightly messy svn repository to git. I tried reading some guides and other SO questions, but get a little lost as to what's the best way to follow.

    The SVN repository has a top-level folder structure with folders, something like:

     |- client
     |- server
     |- website
     |- misc
    

    Most of those folders have the 'standard' svn structure: i.e. trunk, branches and tags. Some are just flat folders however.

     |- client
        |- trunk
        |- branches
        |- tags
     |- server
        |- trunk
        |- branches
        |- tags
     |- website
     |- misc
    

    The branches and tags might have the same name between different folders. For example, both client and server folders might have a branch called 1.0.

    I managed to convert individual folders using svn2git, and it seems to get the history, as well as branches fine. I can manage to create an individual git repository for each folder. However, I'd like to keep everything in one repository eventually.

    What's the best way to merge those folders (now git repositories) into one, whilst maintaining the branches, tags and history of each folder? Using this approach, I seem to lose both the commit history and the branches from the merged-from repository... Or perhaps I'm just missing some important steps or doing something wrong?

    Otherwise, maybe using svn2git on each folder separately is not the best approach to migrate from svn to git?

    解决方案

    I eventually opted for the approach on this answer.

    Essentially:

    • creating a git project for each sub-folder in the svn repository (using svn2git)
    • creating a new git repository merging all repositories into
    • adding each project (including all branches) as a remote:

      git remote add alpha <url/path-to-alpha-repo>
      git remote add bravo <url/path-to-bravo-repo>
      git remote add charlie <url/path-to-charlie-repo>
      for r in $(git remote); do
        git config remote.$r.fetch \
        "$(git config remote.$r.fetch | sed -e 's.remotes.heads/all.')"
        git config --add remote.$r.fetch \
        "$(git config remote.$r.fetch | sed -e 's.heads.tags.g')"
        git config remote.$r.tagopt --no-tags
      done
      git remote update
      

    • pushing the merged-repository to a remote repository (from now on this will be the 'official' repository).

    这篇关于将凌乱的svn仓库转换为git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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