Git svn:我如何使用“部分”分支机构?

发布于 2024-11-09 09:57:37 字数 1832 浏览 0 评论 0原文

“部分”是指我的 SVN 存储库中的分支不是从 trunk/ 复制的,而是从 trunk/ 的子目录复制的。这是 svn 存储库布局:

trunk/
    core
    projectA
    projectB
    ...
branches/
    core_new_feature (branched from "core" on trunk)
    another_branch
    ...

我已经初始化了本地存储库并获取了:

mkdir git-svn-repo
cd git-svn-repo
git svn init -s svn+ssh://me@svn-server/path/to/repository
git fetch
<wait four days>

现在我正在尝试在“core_new_feature”分支上工作。 gitbranch -a 显示:

* master
remotes/core_new_feature
... (a bunch of other branches)

所以我尝试:

git checkout --track -b git_new_feature remotes/core_new_feature

Git 检查文件,并且似乎正在工作。然而,当我尝试浏览我新签出的分支(ls local-git-root/core/)时,我感到很奇怪。具体来说,我没有看到我的源代码或 core_new_feature SVN 分支上的任何现有更改。我在 core/ 下看到的只是一些空目录,似乎是 core 下现有源代码树的随机分布。

但是,“core_new_feature”源可以在 local-git-root/src/ 下找到 - 它就在我的 git 存储库的根目录中。上面的projectA和projectB已经消失了。

我需要的是“core_new_feature”svn 分支上的更改转到正确的位置(即 local-git-root/core/),并且其他项目不会消失

显然我在这里缺少一些关键步骤,但我浏览了所有我能找到的例子,似乎没有一个能解决这个问题。也许我需要以不同的方式设置我的本地存储库?

作为参考,这是我的 .git/config 文件:

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
        hideDotFiles = dotGitOnly
[svn-remote "svn"]
        url = svn+ssh://me@svn-server/path/to/repository
        fetch = repository/trunk:refs/remotes/trunk
        branches = repository/branches/*:refs/remotes/*
        tags = repository/tags/*:refs/remotes/tags/*
[branch "core_new_feature"]
        remote = .
        merge = refs/remotes/core_new_feature

我的存储库使用标准的 Branchs/ Tags/ trunk/ 布局。我使用 msysgit 提供的 git-bash shell 运行命令。版本是1.7.4。

预先感谢您的任何帮助。

By "partial", I mean the branches in my SVN repository were not copied from trunk/, but from a subdirectory of trunk/. Here's the svn repo layout:

trunk/
    core
    projectA
    projectB
    ...
branches/
    core_new_feature (branched from "core" on trunk)
    another_branch
    ...

I have inited my local repository and fetched:

mkdir git-svn-repo
cd git-svn-repo
git svn init -s svn+ssh://me@svn-server/path/to/repository
git fetch
<wait four days>

Now I'm trying to work on the "core_new_feature" branch. git branch -a shows:

* master
remotes/core_new_feature
... (a bunch of other branches)

So I try:

git checkout --track -b git_new_feature remotes/core_new_feature

Git checks out files, and appears to be working. Yet when I try to browse my freshly checked out branch (ls local-git-root/core/), I get weirdness. Specifically, I don't see my source code or any of the existing changes on the core_new_feature SVN branch. All I see under core/ are a few empty directories, a seemingly random smattering of my exiting source tree under core.

However, the "core_new_feature" source is available under local-git-root/src/ - it's just right there in the root of my git repository. projectA and projectB from above have disappeared.

What I need is for the changes on the "core_new_feature" svn branch to go to the correct location (namely local-git-root/core/), and for the other projects to not disappear

Clearly I'm missing some crucial step here, but I've looked through all the examples I could find, and none seems to deal with this issue. Maybe I need to set up my local repository differently?

For reference, here's my .git/config file:

[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
        hideDotFiles = dotGitOnly
[svn-remote "svn"]
        url = svn+ssh://me@svn-server/path/to/repository
        fetch = repository/trunk:refs/remotes/trunk
        branches = repository/branches/*:refs/remotes/*
        tags = repository/tags/*:refs/remotes/tags/*
[branch "core_new_feature"]
        remote = .
        merge = refs/remotes/core_new_feature

My repository uses the standard branches/ tags/ trunk/ layout. I ran the commands using the git-bash shell that msysgit provides. Version is 1.7.4.

Thanks in advance for any assistance.

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

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

发布评论

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

评论(1

闻呓 2024-11-16 09:57:37

我自己没有使用过 git-svn,但是 markjaquith 有一篇很好的文章,介绍了他如何使用它来管理他的 WordPress 开发的提交。您可以考虑浏览一下,看看他是否提到了任何有用的内容。我已经把它藏了起来,以便下次更新我的 WordPress 插件之一,或者创建一个新插件(WordPress 的所有内容都在 svn 上)。

http://markjaquith.wordpress.com/2011/ 05/26/使用-git在wordpress上开发/

I haven't used git-svn myself, but markjaquith has a good post on how he uses it to manage his commits for his WordPress development. You might consider skimming it to see if he mentions anything useful. I've had it tucked away for the next time I update one of my WordPress plugins, or create a new one (everything WordPress is on svn).

http://markjaquith.wordpress.com/2011/05/26/developing-on-wordpress-using-git/

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