git - 如何将 svn 提交历史或 svn 日志迁移到 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 的主干源代码文件夹将被下载到我的本地目录中。
$ 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
推荐阅读
- vba - 如何使Access查询以随机顺序搜索多个关键字
- php - Laravel 在 1 个标题下显示同一日期的所有工作
- php - Paypal Checkout 错误:“SSL 证书问题:无法获取本地颁发者证书”
- java - 如何从 jsp 页面的下拉菜单中显示值?
- reactjs - 每当活动幻灯片发生变化时,是否有 glideJS 事件?
- eclipse - 在没有 Internet 访问权限的情况下安装 Eclipse OpenCL 插件
- javascript - 如何使用 svelte 将其余道具传递给 HTML 元素?
- python - 在 scikit-learn 的 RandomizedSearchCV 中使用保持集进行验证?
- python - 创建/注册 PySpark UDF 并将其应用于一列
- jquery - 通过 AJAX 将大型数组传递给 .Net Core 操作的问题