码迷,mamicode.com
首页 > 其他好文 > 详细

svn迁git保留commit记录

时间:2018-08-25 00:36:17      阅读:461      评论:0      收藏:0      [点我收藏+]

标签:usr   tla   report   oba   checkout   fine   server   fail   clone   

svn to git

一.使用svn2git工具

1.yum install -y ruby git git-svn(配置epel源)
2.gen install svn2git
3.svn2git http://10.6.60.40/svn/XXXX/SourceCode --notrunk --authors /root/users.txt --branches=06platform --branches=06platform/inttest --notag
#如果在分支下还有子目录需要作为分支,使用--branches参数指定path(--branches=06platform/inttest)
4.处理多余分支(git branch -d/-D branch)
5.处理目录(处理目录后需要 git commit、git add、git commit)
6.git remote add origin git@gitlab.xxxx.com:CoreProjectNew/business/frontend.git
7.git push origin --all


二.使用 git svn clone

迁移准备:映射用户文件
1.git svn clone http://10.6.60.40/svn/XXXXSourceCode --authors-file=/root/author.txt --branches=26prpins prpins
2.git checkout -b inttest inttest(处理远程分支为本地分支)
3.git branch -d/-D branch(处理多余分支)
4.处理目录(处理目录后需要 git commit、git add、git commit)
5.git remote add origin git@gitlab.xxxx.com:CoreProjectNew/business/frontend.git
6.git push origin --all

参数说明:

http://10.6.60.40/svn/XXXX/SourceCode #svn仓库地址
--authors-file #映射用户文件
--branches #分支
prpins #项目dir name


迁移过程中因为项目过大或svn服务器不稳定等导致中断,可以使用git svn fetch 更新远程分支

1.cd project/
2.git svn fetch

错误记录:

svn2git工具可能会发生未知错误

1.W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path ‘/SourceCode/25zyicloan‘

解决:这个可能是找不到历史版本导致的,最好指定--revision参数

2.RA layer request failed: REPORT of ‘/svn/XXXX/!svn/me‘: Could not read chunk size: connection was closed by server (http://10.6.60.40) at /usr

解决:遇到这种读取块失败被迫关闭连接,使用git svn clone ,可能是网络等原因导致

3.Author: xx not defined in users.txt file

解决:这个就是保留commit记录用户映射不全,加入users.txt就好了,在做映射时从svn库获取全部用户就行

帮助:

https://help.github.com/articles/source-code-migration-tools/ (github help) 这里详细说明了标准库和非标准库迁移

svn迁git保留commit记录

标签:usr   tla   report   oba   checkout   fine   server   fail   clone   

原文地址:http://blog.51cto.com/674564591/2164060

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!