git svn clone specific branches and merge

后端 未结 2 1253
后悔当初
后悔当初 2021-01-28 14:13

I am looking to migrate my codebase from svn to git. There are too many branches in my svn repo. I only wish to clone couple of branches and merge them together and push it to g

2条回答
  •  野性不改
    2021-01-28 14:52

    git svn fetch (and clone) have --ignore-paths and --include-paths so you can ignore some branches/tags (which are paths in SVN repo) or include only matching branches/tags. So it should be something like

    git init from_svn
    cd from_svn
    git config svn-remote.svn.url "svn://…"
    git config svn-remote.svn.include-paths "^/branches/3\." # Include only branches that match name 3.*
    git svn fetch svn
    

提交回复
热议问题