Cloning a git-svn repository with svn metadata

前端 未结 2 1136
执念已碎
执念已碎 2021-01-30 18:03

I\'ve cloned my main repository with git-svn clone svn://url/trunk --stdlayout. Now I want to clone the repository, with the svn meta data. So that I\'ll be able to

2条回答
  •  感情败类
    2021-01-30 18:36

    It's in the docs. What you should do is:

    git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
    git fetch
    

    to fetch the svn meta-branches. Then you'll be able to git-svn rebase without fetching everything from scratch.


    Quoting from the docs:

    The initial git svn clone can be quite time-consuming (especially for large Subversion repositories). If multiple people (or one person with multiple machines) want to use git svn to interact with the same Subversion repository, you can do the initial git svn clone to a repository on a server and have each person clone that repository with git clone:

    # Do the initial import on a server
            ssh server "cd /pub && git svn clone http://svn.example.com/project
    # Clone locally - make sure the refs/remotes/ space matches the server
            mkdir project
            cd project
            git init
            git remote add origin server:/pub/project
            git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
            git fetch
    # Prevent fetch/pull from remote git server in the future,
    # we only want to use git svn for future updates
            git config --remove-section remote.origin
    # Create a local branch from one of the branches just fetched
            git checkout -b master FETCH_HEAD
    # Initialize 'git svn' locally (be sure to use the same URL and -T/-b/-t options as were used on server)
            git svn init http://svn.example.com/project
    # Pull the latest changes from Subversion
            git svn rebase
    

提交回复
热议问题