如何将 svn 提交历史或 svn 日志迁移到 gitlab

How to migrate svn commit history or svn logs to gitlab

Objective: 将 SVN 日志或 SVN 提交历史迁移到 gitLab。

[请注意:在 Windows 工作] 通过以下步骤成功将代码从 SVN 迁移到 GIT:

$ mkdir svn-migration
$ cd svn-migration
$ svn co <SVN-URL>

检索到 SVN 的作者并存储到文件中 author.txt。

authors.txt的格式:

Pratim = Pratim <email-id>

遵循以下命令:

    $ git config --global user.name "PratimS"
    $ git config --global user.email "SPratim@company.com"
    $ git config --global svn.authorsfile authors.txt
    $ git svn init <svn-url> --stdlayout
    $ git svn fetch

这样,svn的trunk源代码文件夹就会下载到我的本地目录中。

$ git pull origin master
$ git remote add origin <git-url>
$ git push -u origin master

至此我已经成功将所有源码从本地仓库推送到Gitlab

任何关于获取 svn 日志或 svn 中文件的提交历史然后将其推送到 Gitlab 的过程的建议都将非常有帮助。

我找到了所提问题的解决方案。

考虑以下命令:

$ mkdir svn-migration
$ cd svn-migration
$ git config --global user.name "PratimS"
$ git config --global user.email "SPratim@company.com"

我们需要authors.txt文件包含所有在svn中提交代码的成员的信息,格式如上述描述

$ git config --global svn.authorsfile authors.txt
$ git svn clone -r<1st revision number of the folder in svn>:HEAD --authors-file=authors.txt <SVN-URL> <Destination-Folder>

此行检索 svn url 中所有文件的所有提交历史并将其存储到目标文件夹中。我们可以通过在git克隆的文件夹中执行命令来验证它:

$ git log <any file name>

下一步是将目标文件夹中存储的文件推送到Gitlab:

$ git pull origin master

$ git add .

$ git commit . -m "initial commit"

$ git push -u origin master