我可以用git-svn克隆具有多个标准目录布局的svn存储库 [英] Can I git-svn clone an svn repo with multiple standard directory layouts

查看:70
本文介绍了我可以用git-svn克隆具有多个标准目录布局的svn存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个布局类似
的SVN存储库project1/trunk
专案1/分支机构
project1/标签
project2/trunk
项目2/分支机构
project2/标签

I have an SVN repo with a layout like
project1/trunk
project1/branches
project1/tags
project2/trunk
project2/branches
project2/tags
etc.

出于多种原因,我想要一个git-svn仓库,该仓库可以让我从事任何这些项目,并一次从所有项目中提取/提交.这种事可能吗?我知道我可以git-svn克隆整个东西而无需指定分支,标签和主干,但是那样我就会失去使用git的很多优势.

For a number of reasons, I'd like a git-svn repo that allows me to work on any of these projects and fetch/dcommit from/to all of them at once. Is this kind of thing possible? I know I could just git-svn clone the whole thing without specifying branches, tags, and trunk, but then I'd lose a lot of the advantage of using git.

推荐答案

这就是我的方法.不过,可能有更简单的方法.

This is how I did it. There may be simpler ways, though.

  1. 选择要使用标准布局的第一个项目,然后 git svn clone

git svn clone --stdlayout http://sample.com/svn/repository-name/project-name仓库名称

进入 repository-name 目录并编辑其 .git/config 文件.您也可以使用 git-config 命令执行此操作,但是我发现在文本编辑器中更容易.

Go into the repository-name directory and edit its .git/config file. You could also do this with git-config commands, but I find it easier in a text editor.

您将看到已经为第一个项目定义的 [svn-remote"svn"] 部分.将 svn-remote 重命名为比"svn" 更独特的名称,可能与您的项目名称相同.例如 [svn-remote"project-name"] .

You'll see an [svn-remote "svn"] section already defined for your first project. Rename the svn-remote to something more unique than "svn", probably the same as your project name. E.g., [svn-remote "project-name"].

按照第一个模板的模板,为每个项目添加更多的 [svn-remote"project-name"] 部分.给每个人起一个独特的名字!您需要更改 fetch branches tags 设置,以便为每个项目使用正确的Subversion目录名称.

Make more [svn-remote "project-name"] sections for each project, following the template of the first one. Give each one a unique name! You'll need to change the fetch, branches, and tags settings to use the correct Subversion directory names for each project.

完成后,保存文件并运行 git svn fetch --fetch-all .其他项目将作为本地存储库中的远程项目获取.

Once you're done, save your file and run git svn fetch --fetch-all. The other projects will be fetched as remotes in your local repository.

要在项目之间切换 master ,请执行 git reset --hard other-project-name/trunk ,就像您要切换工作一样在其他任何远程Subversion分支上.

To switch your master between projects, do a git reset --hard other-project-name/trunk, just like if you were switching to work on any other remote Subversion branch.

这篇关于我可以用git-svn克隆具有多个标准目录布局的svn存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆