使用 git-svn 克隆整个 SVN 存储库后,如何切换到 trunk?

发布于 2024-12-13 09:02:43 字数 500 浏览 6 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情感失落者 2024-12-20 09:02:43

为了避免完全重新克隆,您只需使用以下内容更新 .git/config 文件:

[svn-remote "svn"]
url = http://server.org/svn
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*

然后删除 .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:

[svn-remote "svn"]
url = http://server.org/svn
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*

Then delete .git/svn/.metadata and run git svn fetch again

PS: 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.

妥活 2024-12-20 09:02:43

克隆时必须使用 -s (标准布局)开关:

git svn -s clone http://server/repo

此开关将告诉 git-svn 从 ^/branches 中找到的目录创建分支和标签,分别是^/tags^/trunk 将映射到 git 的 master 分支。

恐怕,你将不得不重新克隆你的 svn 存储库......

You have to use the -s (standard layout) switch when cloning:

git svn -s clone http://server/repo

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's master branch.

I'm afraid, you will have to re-clone your svn repository …

风向决定发型 2024-12-20 09:02:43

您可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文