从svn转换到git

数据中心之前的代码一直使用svn进行管理,现在team已经转换到git了。需要将之前的版本代码也全部转换到git了。
转换步骤在这本git书中有详细的说明:
http://git-scm.com/book/zh/v1/Git-与其他系统-迁移到-Git
但在试验过程中,发现有几处地方不能完整执行,需要进行修改。修改后的代码如下:
#clone metadata
git svn clone https://svn.westgis.ac.cn/svn/westdc/metadata --authors-file=users.txt --no-metadata --stdlayout westdc-zf1

#convert tags to local
git for-each-ref refs/remotes/origin/tags | cut -d / -f 5-| grep -v @ | while read tagname; do git checkout -b "$tagname" origin/tags/$tagname; git checkout master; git tag $tagname $tagname;git branch -D "$tagname";git branch -r  -d "origin/tags/$tagname";done

#convert branches to local
git for-each-ref refs/remotes | cut -d / -f 4- | grep -v @ | while read branchname; do git checkout -b "$branchname" origin/$branchname;git branch -r -d origin/$branchname; done

git remote add origin git@git.westgis.ac.cn:westdc/westdc-zf1.git
git push origin --all
git push origin --tags

 


已发布

分类

,

来自

标签:

评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注