• 我的svn迁移到git


    我的svn迁移到git

     折腾了一段时间,还是决定迁移到Git和Hg。

    我的迁移命令序列
    0 建立authors.txt文件,代码作者的名称对应表
    svnuser = gituser <gituser@gmail.com>
    1 导入典型结构的svn库
    git svn clone svn://localhost/svn -s --authors-file=authors.txt --no-metadata repo.git
    //由于是永久性迁移,所以此处用了--no-metadata,如果未来还需要互操作,建议不使用。
    2 进入库
    cd repo.git
    3 导入忽略列表  
    git svn show-ignore > .gitignore
    4 移动远程标签到本地
    cp -Rf .git/refs/remotes/tags/* .git/refs/tags/
    rm -RF .git/refs/remotes/tags
    5 移动远程分支到本地
    cp -Rf .git/refs/remotes/* .git/refs/heads/
    rm -Rf .git/refs/remotes
    基本完成
    剩下的可选操作包括
    a.添加远程库,并推
    git remote add origin https://localhost/git
    git push remotes --all
    有时候可能还需要
    git push --tags
    b.压缩库
    git gc
    c 导入非典型结构的svn库
    git svn clone svn:://localhost --authors-file=authors.txt --no-metadata repo.git
    d 导入忽略列表并以.gitignore形式建立新的列表 
    git svn create-ignore
    //会在每个目录内添加.gitignore文件,并且自动添加相应内容
    或者
    git svn show-ignore > /info/exclude
    //会将忽略列表添加到exclude文件中,但exclude作用仅限本地
    如果报告错误
    config --get svn-remote.svn.fetch :refs/remotes/git-svn$: command returned error: 1
    则可以通过指定分支解决
    git svn show-ignore -i trunk > .gitignore

    整理自 

     http://www.blogjava.net/lishunli/archive/2012/01/15/368562.html

    http://superuser.com/questions/429686/how-do-i-resolve-the-git-svn-error-refs-remotes-git-svn-command-returned-erro 

    http://john.albin.net/git/convert-subversion-to-git 

  • 相关阅读:
    3
    正确的消费理念和方式
    2
    1
    善待精力,保持体力,保持热情
    为什么不从今天开始呢?
    c++中的新成员
    函数重载分析下
    函数重载分析上
    函数参数的扩展
  • 原文地址:https://www.cnblogs.com/kevinzhwl/p/2600990.html
Copyright © 2020-2023  润新知