从 svn 迁移到 git,并保留 commit 日志

之前为公司做了个基于 yeoman 的脚手架工具,公司是使用 svn 做版本控制的,所以这个工具也就使用了 svn 来记录版本。 近期想做个迁移,把它放到 github 上去,这里对迁移过程做个简单的记录。 首先,svn 地址是 http://svn.com.cn/svn/generator-pczt/ (非真实 svn 地址,这里做个举例) 该项目位置在 svn 中的 base repository,因此不涉及到 tags,branches,trunk。 用户映射 按照网上文章,先创建个文件(users.txt),做个用户映射,将 svn 的用户和 git 上的用户关联起来。 chenwudong = vdorchan <vdorchan@gmail.com> git svn clone 按照文档中的命令 # --stdlayout 跟踪标准的Subversion存储库 # -authors-file 指定用户映射的文件 git svn clone --stdlayout --no-metadata -authors-file=users.txt http://svn.com.cn/svn/generator-pczt/ generator-pczt 输入上述的命令后,在 generator-pczt中创建了一个空的 git 仓库,但并没有将文件从 svn 拉下来,并且命令行输出了以下的一些信息。 Initialized empty Git repository in /Users/vdorchan/Documents/www/Learn-Yeoman/generator-pczt/.git/ Using higher level of URL: http://svn.com.cn/svn/generator-pczt => http://svn.com.cn/svn W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/generator-pczt' W: Do not be alarmed at the above message git-svn is just searching aggressively for old history....

November 9, 2018 · 1 min · vdorchan