svn迁git保留commit记录

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) 这里详细说明了标准库和非标准库迁移

转载于:https://blog.51cto.com/674564591/2164060

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值