本文介绍了git-svn只导入分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的svn repo中只导入1个分支作为git存储库。所以我希望那个分支的内容成为主人。我不希望存储库中的任何其他东西。我也不想真的能够承诺原始的SVN回购。其实,我不希望发生任何事情发生在我的svn回购。



示例:

 分行
分行1
分行2
某分行
项目

所以我希望项目文件夹的内容成为我的主分支。我该怎么做?



谢谢。

编辑



看起来好像有分支合并到我的分支中,并且git-svn找不到历史记录,因为它看起来在

branches / some-branch / project / branches / branch1



它认为我的远程分支是根。

解决方案
1)在.git / config中定义新的分支:

  [svn-remoterelease-branch] 
url = svn + ssh://[email protected]/source/branches/mono -2-2 / mcs
fetch =:refs / remotes / git-svn-release-branch



2)导入SVN分支。 SVN_BRANCHED_REVISION是分支在SVN中发生的修订。

  [〜] $ git svn fetch release-branch -r SVN_BRANCHED_REVISION 

3)将本地Git分支连接到远程分支:

  [〜] $ git branch --track release git-svn-release-branch 


$ b $ 5结帐和更新

$ $ p $ $ $ $ $ $ g $ checkout release
[〜] $ git svn rebase


I want to import only 1 branch from my svn repo as a git repository. So I want the contents of that branch to become the master. I don't want anything else in the repository. I also don't really want to be able to commit to the original svn repo. Actually, I don't want anything to happen to my svn repo.

Example:

branches
  branch1
  branch2
  some-branch
    project

so I want content of the project folder to become my master branch. How can I do that?

Thank you.

EDIT

looks like there are branches that were merged into my branch, and git-svn can not find history because it looks in

branches/some-branch/project/branches/branch1

it thinks that my remote branch is the root. How can I fix it?

解决方案

1) Define the new branch in .git/config :

[svn-remote "release-branch"]
        url = svn+ssh://[email protected]/source/branches/mono-2-2/mcs
        fetch = :refs/remotes/git-svn-release-branch

2) Import the SVN branch. SVN_BRANCHED_REVISION is the the revision when the branch happened in SVN.

[~]$ git svn fetch release-branch -r SVN_BRANCHED_REVISION

3) Hook up a local Git branch to the remote branch:

[~]$ git branch --track release git-svn-release-branch

5) Checkout and update

[~]$ git checkout release
[~]$ git svn rebase

这篇关于git-svn只导入分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 23:40