打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Migrate from svn to git | GitStack

Migrate from svn to git

Mon, Apr 2, 2012
Subversion was the most used versioning system until last year. A majority of new projects are now using git and most of the older but active project are now migrating from subversion to git.

This tutorial will show you how to migrate your subversion server (online hosted or using a software like visualsvn server) to a git server (GitStack).

The migration process has 4 steps :
1. Use git to checkout your svn repository
2. Clean your project from unnecessary files
3. Create a new remote git repository on GitStack
4. Push your repository to GitStack

Prerequisites :
-msysgit installed on a client computer
-GitStack installed on a remote computer

1. Use git to checkout your svn repository


We take as our svn repository example “fotoslide” which is a project randomly chosen on google code http://code.google.com/p/fotoslide/

Launch git bash (provided by msysgit)


Checkout your svn project on your client computer :
$ git svn clone http://fotoslide.googlecode.com/svn/ –no-metadata -s fotoslide

Git will download all the repository files and history. It might take a few minutes/hours depending of the size of your svn repository. The ‘–no-metadata’ parameter is used to remove unnecessary svn backward compatibility data (git-svn-id is not imported).



2. Clean your project from unnecessary files


Get into your project directory :
$ cd fotoslide

Convert weird tag branches to real git tags :
$ cp -Rf .git/refs/remotes/tags/* .git/refs/tags/
$ rm -Rf .git/refs/remotes/tags

Convert old svn branches to real git branches :
$ cp -Rf .git/refs/remotes/* .git/refs/heads/
$ rm -Rf .git/refs/remotes



3. Create a new remote git repository on GitStack


Launch GitStack on your server and create one user
Create a repository. We will name it fotoslide.
Add a user with read/write access to the repository.




4. Push your repository to GitStack


Add the git server as a remote server :
$ git remote add origin http://10.0.2.15/fotoslide.git

Push your code to the new server, including all the tags and branches :
$ git push origin –all



You have successfully migrated your repository from svn to git.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
GIT版本控制 — GIT与SVN的相互转换 (三)_git转svn
建本地 repo server --- 超复杂型 -- 备份
git bundle手册
Git pull 小结
SVN数据迁移到Git笔记
Git 使用手冊 | TKG
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服