目标:将 SVN 日志或 SVN 提交历史记录迁移到 gitLab。
[请注意:在窗口中工作] 通过以下步骤成功将代码从SVN迁移到GIT:
$ mkdir svn-migration
$ cd svn-migration
$ svn co <SVN-URL>
检索SVN的作者并存储到文件作者.txt中。
作者格式.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