使用 git-svn 克隆整个 SVN 存储库后,如何切换到 trunk?
我使用 git-svn 克隆了整个 SVN 存储库(包括所有分支)。问题是,如果我运行 gitbranch ,我不会得到任何结果。如果我运行 gitbranch -a ,我会得到:
git-svn
我现在应该做什么来开始在 SVN 的主干上工作?
编辑:存储库是按标准布局组织的,但是当我拉动时,我这样做是这样的:
git svn clone http://server/repo ( without any other options )
而不是像
git svn clone http://server/repo/trunk
我的 gitconfig 看起来像这样:
[svn-remote "svn"]
url = svn_url
fetch = :refs/remotes/git-svn
I cloned an entire SVN repository ( including all the branches ), using git-svn. The problem is, if I run git branch
I don't get anything back. If I run git branch -a
I get:
git-svn
What should I do now to start working on SVN's trunk
?
EDIT: The repo is organized in the standard layout, but when I pulled I did it like:
git svn clone http://server/repo ( without any other options )
and not like
git svn clone http://server/repo/trunk
My gitconfig looks like this:
[svn-remote "svn"]
url = svn_url
fetch = :refs/remotes/git-svn
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为了避免完全重新克隆,您只需使用以下内容更新
.git/config
文件:然后删除
.git/svn/.metadata
并运行git svn fetch再次
PS:这受到我从Git-SVN 具有多个分支位置? 当我不得不处理一些非- 标准布局。
To avoid a complete reclone you can just update the
.git/config
file with the following:Then delete
.git/svn/.metadata
and rungit svn fetch
againPS: This was inspired from what I found out from Git-SVN with multiple branch locations? when I had to deal with some repo with non-standard layout.
克隆时必须使用
-s
(标准布局)开关:此开关将告诉 git-svn 从
^/branches
中找到的目录创建分支和标签,分别是^/tags
。^/trunk
将映射到 git 的master
分支。恐怕,你将不得不重新克隆你的 svn 存储库......
You have to use the
-s
(standard layout) switch when cloning:This switch will tell git-svn to create branches and tags from the directories found in
^/branches
, respectively^/tags
.^/trunk
will be mapped to git'smaster
branch.I'm afraid, you will have to re-clone your svn repository …
您可以使用 SmartGit 克隆 SVN 存储库。它会检测您的主干/分支/标签配置并正确配置布局,因此您不必担心它。
You may clone SVN repostiory with SmartGit. It detects your trunk/branches/tags configuration and configures the layout correctly, so you have not to bother about it.