使用svn元数据克隆git-svn存储库

Ela*_*ich 23 svn git git-svn

我用克隆了我的主存储库git-svn clone svn://url/trunk --stdlayout.现在我想用svn元数据克隆存储库.这样我就可以到git-svn rebase主服务器了.

注意,我不想在两个git-svn克隆之间推送提交,我只是想将所有git-svn元数据添加到新克隆的存储库中,以便新克隆也能够与主要的subversion服务器通信.

Ela*_*ich 30

它在文档中.你应该做的是:

git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch
Run Code Online (Sandbox Code Playgroud)

获取svn元分支.然后你就可以git-svn rebase不用从头开始取出所有东西.


引用文档:

最初的git svn克隆可能非常耗时(特别是对于大型Subversion存储库).如果多个人(或一个拥有多台机器的人)想要使用git svn与同一个Subversion存储库进行交互,则可以将初始git svn clone执行到服务器上的存储库,并让每个人使用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
Run Code Online (Sandbox Code Playgroud)