如何使用git-svn将svn分支集成到git分支中?

发布于 2024-10-19 17:05:34 字数 2419 浏览 2 评论 0原文

我没有太多 svn 经验,但我习惯使用 git。

我有以下 svn 存储库结构和修订。

https://server/svn/solution/trunk/solution.sln @ r100
https://server/svn/solution/trunk/project1/project1.csproj @r150
https://server/svn/solution/trunk/project2/project2.csproj @r160

https://server/svn/solution/branches/solution.sln @ r100
https://server/svn/solution/branches/project1/project1.csproj @r200
https://server/svn/solution/branches/project2/project2.csproj @r350

当我克隆存储库时

git svn 克隆 https://server/svn/solution --stdlayout

我得到了一切

(master)$ git branch -a  
* master  
  remotes/project1  
  remotes/project2  
  remotes/trunk  

当我想创建一个本地 当我签出分支时,我得到的所有远程分支

(master)$ git checkout -b local-project1 project1

都是project1。该分支不包含任何来自

https://server/svn/solution/branches/solution.sln @ r100

解决问题我尝试了以下操作:

(local-project1)$ git checkout master
Switched to branch 'master'.
(master)$ git branch local-project1 -D
Deleted branch local-project1 (was 1111a11).
(master)$ git checkout -b local-project1
Switched to new branch 'local-project1'.
(local-project1)$ pwd
/c/workingcopies/solution
(local-project1)$ cd project1
(local-project1)$ pwd
/c/workingcopies/solution/project1
(local-project1)$ git branch --set-upstream local-project1 remotes/project1
Branch local-project1 set up to track local ref refs/remotes/project1.
(local-project1)$ git svn fetch
(local-project1)$ git reset --hard ae8e9b1a ;# go to last commit of the remote branch

fetch 从存储库中的分支获取最后的修订版本,并且 HEAD 设置为最后一次提交,但我仍然只在分支中获取 project1,而不是解决方案。如有任何建议和帮助,我们将不胜感激。

i have not much svn experience but i am used to work with git.

I have the following svn repository structure and revisions.

https://server/svn/solution/trunk/solution.sln @r100
https://server/svn/solution/trunk/project1/project1.csproj @r150
https://server/svn/solution/trunk/project2/project2.csproj @ r160

https://server/svn/solution/branches/solution.sln @r100
https://server/svn/solution/branches/project1/project1.csproj @r200
https://server/svn/solution/branches/project2/project2.csproj @ r350

When i clone the repository

git svn clone https://server/svn/solution --stdlayout

I get everything

(master)$ git branch -a  
* master  
  remotes/project1  
  remotes/project2  
  remotes/trunk  

When i want to create a local branch for a remote one

(master)$ git checkout -b local-project1 project1

all i get when i checkout the branch is project1. The branch does not contain anything from

https://server/svn/solution/branches/solution.sln @r100

To solve the problem i tried the following:

(local-project1)$ git checkout master
Switched to branch 'master'.
(master)$ git branch local-project1 -D
Deleted branch local-project1 (was 1111a11).
(master)$ git checkout -b local-project1
Switched to new branch 'local-project1'.
(local-project1)$ pwd
/c/workingcopies/solution
(local-project1)$ cd project1
(local-project1)$ pwd
/c/workingcopies/solution/project1
(local-project1)$ git branch --set-upstream local-project1 remotes/project1
Branch local-project1 set up to track local ref refs/remotes/project1.
(local-project1)$ git svn fetch
(local-project1)$ git reset --hard ae8e9b1a ;# go to last commit of the remote branch

The fetch gets the last revision from the branch in the repository and the HEAD is set to the last commit but i still only get project1 in the branch, not the solution. Any advice and help is appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

深爱成瘾 2024-10-26 17:05:34

问题是你没有标准的 svn 布局。标准布局在每个分支的分支下都有目录,如下所示。

repo/
  +-- trunk
  |     +-- solution.sin
  |     +-- project1/project1.csproj
  |     +-- project2/project2.csproj
  +-- branches/
        +-- branch01/
              +-- solution.sin
              +-- project1/project1.csproj
              +-- project2/project2.csproj

相反,您有一个主干和一个名为“branches”的分支,位于与主干相同的目录中。

我不确定是否可以告诉 git 正确处理这个问题。我有一些想法:您可以编辑 .git/config 以使 git 在最顶层目录中查找分支,但是当它尝试创建一个名为 trunk 的分支而它已经有一个 trunk 时,它可能会感到困惑。

The problem is that you do not have a standard svn layout. A standard layout would have directories under branches for each branch, like so.

repo/
  +-- trunk
  |     +-- solution.sin
  |     +-- project1/project1.csproj
  |     +-- project2/project2.csproj
  +-- branches/
        +-- branch01/
              +-- solution.sin
              +-- project1/project1.csproj
              +-- project2/project2.csproj

You instead have a trunk and a branch called "branches" located in the same directory as trunk.

I'm not sure if git can be told to handle this properly. I have some ideas: You could edit .git/config to make git look for a branch in the topmost directory, but then it might be confused when it tries to make a branch called trunk while it already has a trunk.

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