How to use git-svn to checkout only trunk and not branches and tags?

后端 未结 3 1701
感情败类
感情败类 2020-12-24 11:18

I\'m working on a Java legacy project which has 20 modules connected to each other. So, each module has it\'s own branch and tag. The structure is like this:



        
3条回答
  •  渐次进展
    2020-12-24 11:54

    I just wanted to add more information based on @me_and's answer.

    the command given to clone just trunk is gonna work but in the git folder the structure created was:

    refs
     |--remotes
        |--git-svn
    

    which is equivalent of refs/remotes/git-svn.

    if we do this instead:

    git svn clone https://domain/svn/repo/trunk --no-metadata --authors-file=authors.txt --trunk=https://domain/svn/repo/trunk
    

    then the structure created is:

    refs
     |--remotes
        |--origin
           |--trunk
    

    which is equivalent to refs/remotes/origin/trunk

    The second structure looks more git-friendly and potentially could reduce the commands and shell scripts you have to write :)

    P.S. the [--no-metadata] and [--author-file] arguments are optional.

    • metadata option disables git to append svn information after commit message.
    • authors-file option allows you to map your svn contributors to git contributors so your svn historical revisions won't be messed up in git.

提交回复
热议问题