目的:将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的主干源代码文件夹将被下载到我的本地目录中。
$ git pull origin master
$ git remote add origin <git-url>
$ git push -u origin master因此,我已经成功地将所有源代码从本地存储库推送到Gitlab。
任何关于获取svn日志或svn中文件提交历史并将其推送到Gitlab的过程的建议都将非常有用。
发布于 2018-06-08 15:28:11
我想出了解决问题的办法。
请考虑以下命令:
$ 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 masterhttps://stackoverflow.com/questions/50725556
复制相似问题