从Subversion迁移到git,克隆所有分支并推送gitolite? [英] Migrate from Subversion to git, clone all branches and push through gitolite?

查看:108
本文介绍了从Subversion迁移到git,克隆所有分支并推送gitolite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直致力于将我们的9个项目在一个SVN仓库中移动到9个独立的git仓库,由gitolite在服务器上进行管理,然后关闭SVN。其中七个很容易,因为他们在我的工作站上没有分支或标签,所以我可以做一个简单的操作:

I've been working on moving our 9 projects in one SVN repo over to 9 separate git repos, managed on a server by gitolite then shutting down SVN. Seven of them were easy as they had no branches or tags so on my workstation I was able to do a simple:

git svn clone --stdlayout --no-metadata -A svnauthors.txt svn+ssh://user@host/var/subversion/project tempProject

然后从我的工作站推送到gitolite服务器:

Then pushed from my workstation to the gitolite sever via:

 git remote add origin ssh://gitolite@host/project
 git push -u origin master

一直在努力工作。现在最后的两个项目更加困难,每个项目大约有30个标签/分支。在我看到的那些项目之一上运行'git svn clone'之后:

and they have all been working great. Now the final two projects are more difficult, having about 30 tags/branches each. After running the 'git svn clone' as above on one of those projects I see:

$ git branch -a
* master
  remotes/BatchUpload
  remotes/clarify_breadcrumb
  remotes/contact_type
  remotes/contact_upload_improvements
  remotes/file_cabinet
  remotes/mobile
  remotes/summary_tiles
  remotes/summary_updates
  remotes/tags/release-2.1.2
  remotes/tags/release-3.0.1
  remotes/tags/release-3.0.2
  remotes/tags/release-3.0.2c
  remotes/tags/release-3.1.1
  remotes/tags/release-3.1.3
  remotes/tags/release-3.1.4
  remotes/tags/release-3.1.5
  remotes/tags/release-3.1.5.UPDT
  remotes/tags/release-3.2
  remotes/tags/release-3.2.1
  remotes/tags/release-3.2.2.1
  remotes/tags/release-3.2.3
  remotes/tags/release-3.2.4
  remotes/tags/release-3.2.6
  remotes/tags/release-3.2.7
  remotes/tags/release-3.2.7.1
  remotes/trunk
  remotes/user_man_batch_upload
  remotes/user_management

现在我该如何处理所有这些标记/分支到我的本地工作站,所以我可以推他们通过gitolite并永久关闭SVN服务器?我需要在本指南中做什么,为每个分支和标记执行git checkout -b操作?我应该使用svn2git或其他工具吗?

Now how do I go about getting all those tags/branches downloaded to my local workstation so I can push them through gitolite and shutdown the SVN server permanently? Is what I need to do in this guide, doing a 'git checkout -b' for each branch and tag? Should I be using svn2git or some other tool for this?

推荐答案

在freenode irc的#git中有帮助的人给我写了一些信息命令让我的标签和分支从SVN复制到Git:

A helpful person in #git on freenode irc wrote me a little command to get my tags and branches copied over to Git from SVN:

分支:

Push branches:

printf "git push origin "; git show-ref | grep refs/remotes | grep -v '@' | grep -v remotes/tags | perl -ne 'print "refs/remotes/$1:refs/heads/$1 " if m!refs/remotes/(.*)!'; echo

运行打印出的命令

推送标签:

printf "git push origin "; git show-ref | grep refs/remotes/tags | grep -v '@' | perl -ne 'print "refs/remotes/tags/$1:refs/tags/$1 " if m!refs/remotes/tags/(.*)!'; echo

运行打印出的命令

这篇关于从Subversion迁移到git,克隆所有分支并推送gitolite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆