linux查找svn仓库,随笔—SVN仓库转换为Git仓库

假设需要转换的SVN仓库地址为:https://tmp/svn

1、使用git svn clone命令开始转换

$ git svn clone https://tmp/svn -T trunk -b branches -t tags

#git svn clone会将整个SVN仓库导入到一个本地仓库中,

#-T trunk -b branches -t tags告诉Git,需要clone的SVN仓库的基本分支和命名法则

#如SVN里的trunk,等同于Git里的master分支,整条选项可以使用-s代替

$ git svn clone https://tmp/svn -s   #此命令与上面的效果一样

2、Clone完成后,使用git show-ref命令查看git仓库的基本情况

$ git show-ref

f9e1af7a36109cdfb7934d2e9d9e7f7375609e43 refs/heads/master

f9e1af7a36109cdfb7934d2e9d9e7f7375609e43 refs/remotes/origin/HEAD

f9e1af7a36109cdfb7934d2e9d9e7f7375609e43 refs/remotes/origin/master

131ecb795ceb25ae7645b5eca041bad9c455f95b refs/remotes/origin/test

3、转换SVN仓库的svn:ignore属性到Git仓库的.gitignore文件

$ git svn create-ignore

4、 转换SVN的标签为Git标签

$ cp -Rf .git/refs/remotes/tags/* .git/refs/tags/

$ rm -Rf .git/refs/remotes/tags

5、 转换SVN的分支为Git分支

$ cp -Rf .git/refs/remotes/* .git/refs/heads/

$ rm -Rf .git/refs/remotes

6、最后把转换完成的本地Git仓库推送到Git服务器上

$ git remote add origin remote_address

$ git push origin master --all

SVN那边所有的标签和分支都可以变更到了Git服务器里了。

原创文章,作者:N21-沉舟,如若转载,请注明出处:http://www.178linux.com/21199

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值