使用svn元数据克隆git svn存储库
我已经用使用svn元数据克隆git svn存储库,svn,git,git-svn,Svn,Git,Git Svn,我已经用git svn clone克隆了我的主存储库svn://url/trunk --标准布局。现在我想克隆存储库,使用svn元数据。这样我就能够git svn将它重新基址到主服务器 注意,我不想在两个git svn克隆之间推送提交,我只想将所有git svn元数据添加到新克隆的存储库中,以便新克隆也能够与主subversion服务器通信。它位于。你应该做的是: git config --replace-all remote.origin.fetch '+refs/remotes/*:refs
git svn clone克隆了我的主存储库svn://url/trunk --标准布局
。现在我想克隆存储库,使用svn元数据。这样我就能够git svn将它重新基址到主服务器
注意,我不想在两个git svn
克隆之间推送提交,我只想将所有git svn
元数据添加到新克隆的存储库中,以便新克隆也能够与主subversion服务器通信。它位于。你应该做的是:
git config --replace-all remote.origin.fetch '+refs/remotes/*:refs/remotes/*'
git fetch
获取svn
元分支。然后,您将能够git svn rebase
,而无需从头开始获取所有内容
从文件中引用:
最初的git svn克隆可能非常复杂
耗时(尤其是对于大型
Subversion存储库)。如果多个
人员(或一人多人)
机器)要使用git svn
与同一个Subversion交互
存储库中,您可以执行初始git
svn克隆到服务器上的存储库
让每个人都克隆这个
具有git克隆的存储库:
远程计算机之间的超级快速简单拷贝克隆
从:
“git clone”不克隆refs/remotes/hierarchy或任何“git svn”元数据或配置下的分支。因此,如果要进行克隆,使用“git svn”创建和管理的存储库应该使用“rsync”进行克隆
只需使用cp-rp
即可在同一台机器上复制克隆,也可以使用scp-rCp
从远程机器复制克隆
然而,由于需要复制大量的小文件,远程案例可能非常慢(即使在以太网上也要10分钟)
使用可以避免这种开销,这意味着(取决于带宽)只需几秒钟(对于50Mbit/s连接上的100Mb git repo)
在本地计算机上的当前工作目录中生成新的git repo“WonderProject”
(请注意,我提到的文档几乎否认@Elazar引用的部分的存在,因此我不是在怀疑@Elazar的优秀解决方案,而是在寻找一个更简洁、令人难忘的解决方案)使用rsync而不是cpio hack不是更好吗?两者都应该以批量方式传输所有文件。有明显的时差吗?可能,可能。我不熟悉rsync。为什么cpio是黑客和rsync犹太教徒?问题:如果你只想要一个子目录(例如,trunk
),但签出拥有一切,你怎么做?git svn rebase
挂在那里。如果gitsvn存储库与svn是最新的,那么它应该是最快的吗?
# 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
ssh -C <user>@<host> "cd <path to parent dir of repo>; \
find <repo directory name> -depth -print | cpio -oa" | cpio -imd
ssh -C alex@myhost "cd ~alex/repos/; \
find WonderProject -depth -print | cpio -oa" | cpio -imd