svn 迁移到 git 仓库并保留 commit 历史记录
1、svn 转换为 git(会提示,让你输入先前 svn 的账号与密码)# 切换至 本地项目目录
cd /Users/jianbao/PhpStormProjects/fiisoo/
# 克隆 svn 项目,并转换为 git 项目
git svn clone svn://IP地址/projectname --no-metadataprojectname2
2、添加远程 git 仓库
cd /Users/jianbao/PhpStormProjects/fiisoo/projectname2
git remote add origin git@xxx.xxx.xxx.xxx:root/projectname2.git
3、推送代码到远程 git 仓库
git push -u origin master
特别说明
当执行完 git svn clone svn://IP地址/projectname --no-metadataprojectname2 命令后,会在项目的 .git/config 文件中添加 svn 远程库信息,如下所示:
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
noMetadata = 1
url = svn://IP地址/projectname
fetch = :refs/remotes/git-svn
url = git@xxx.xxx.xxx.xxx:root/projectname2.git
fetch = +refs/heads/*:refs/remotes/origin/*
强烈推荐把 节点信息删除掉,留着也没啥用,碍事!
即把以下信息删除掉:
noMetadata = 1
url = svn://IP地址/projectname
fetch = :refs/remotes/git-svn
参考:
http://www.cnblogs.com/rwxwsblog/p/5725710.html
http://www.cnblogs.com/chen110xi/p/4301935.html
页:
[1]