git svn 部分颠覆树

发布于 2024-12-05 13:07:30 字数 1380 浏览 8 评论 0原文

我正在使用 git 在本地计算机上开发当前项目。 有一个颠覆服务器,我必须根据我当前的主分支不时更新它。

假设我在 svn 中的目录是:

project/module/

在这个目录中,有一个通用目录和我的 svn 结构

project/module/aDirectory
project/module/myGitDirectory/trunk
project/module/myGitDirectory/branches
project/module/myGitDirectory/tags

在 git-svn 之后,我将 git 设置为使用该目录作为上游:

[svn-remote "svn"]
        url = https://mygit.test.com/project
        fetch = module/myGitDirectory/trunk:refs/remotes/trunk
        branches = module/myGitDirectory/branches/*:refs/remotes/*
        tags = module/myGitDirectory/tags/*:refs/remotes/tags/*

我在 git 中正常工作,并将我的更改提交

git svn dcommit

到部分 svn 树

这工作得很好,直到其他人提交的

project/module/aDirectory

内容不在我本地的 git 存储库中。

git svn dcommit 的失败是:

Unable to determine upstream SVN information from HEAD history.

我用 google 搜索了该问题并在 so 中找到了一些解决方案,但这些解决方案并没有真正帮助我。要么它根本不起作用,要么我不得不手动合并数十个文件,这是我不想要的。 我当前的解决方法是签出完整的 svn,将更改从 git 复制到 svn 存储库,然后提交它们。

所以我的问题是,是否可以像我一样在 git-svn 中使用这样的部分 svn 树? 我是否为 git-svn 指定了错误的目录而犯了任何错误? 或者 git-svn 不是适合我的场景的解决方案。

如果我可以按照开始的方式执行此操作,那么 svn 提交到本地 git 中未跟踪的文件会发生什么情况?

我在其他一些项目中使用了 svn 和 git 的组合,从未遇到任何麻烦,但整个 svn 树也在 git 中管理。因此,对 svn 的每个提交在我的 git 存储库中都有一个适当的位置:)

I'm using git for developing a current project on my local machine.
There exists a subversion server which I have to update from time to time, based on my current master branch.

Lets say my directory in the svn is:

project/module/

In this directory there is one general directory and my svn structure

project/module/aDirectory
project/module/myGitDirectory/trunk
project/module/myGitDirectory/branches
project/module/myGitDirectory/tags

Following git-svn I setup my git to use the directory as a upstream:

[svn-remote "svn"]
        url = https://mygit.test.com/project
        fetch = module/myGitDirectory/trunk:refs/remotes/trunk
        branches = module/myGitDirectory/branches/*:refs/remotes/*
        tags = module/myGitDirectory/tags/*:refs/remotes/tags/*

I worked normally in git and committed my changes just with

git svn dcommit

to the partial svn tree

This worked quite fine, until someone else committed in

project/module/aDirectory

which is not in my local git repo.

The failure for git svn dcommit was:

Unable to determine upstream SVN information from HEAD history.

I googled that problem and found some solutions here in so, but the solutions didn't really help me out. Either it didn't work at all or I had to handmerge dozens of files, which I don't want.
My current workaround is checkout the complete svn, copy changes from git to svn repo and just commit them.

So my question is, is it possible to use such a partial svn tree within git-svn, the way I do?
Did I made any mistake by specifying wrong directories for git-svn?
Or is git-svn not an appropriate solution for my scenario.

And if I can do this the way I started, what happens with the svn commits to files which are not tracked in my local git?

I'm using the combination of svn and git in some other projects and never ran into any trouble, but there the whole svn tree is also managed in git. So each commit to svn has an appropriate place in my git repo :)

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

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

发布评论

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

评论(1

小红帽 2024-12-12 13:07:30

很奇怪。但你也可以将 aDirectory 克隆到 git。只需将其添加到配置中,

[svn-remote "svn-extra"]
        url = https://mygit.test.com/project
        fetch = aGitDirectory:refs/remotes/aDirectory

在从 svn 克隆 aDirectory 后

git svn fetch svn-extra

,尝试使用存储库中已有的新目录获取前一个目录,

git svn fetch --fetch-all

这可能有助于 git-svn 理解这种非典型提交。

It's weird. But you could clone aDirectory to git also. Just add this to the config

[svn-remote "svn-extra"]
        url = https://mygit.test.com/project
        fetch = aGitDirectory:refs/remotes/aDirectory

After this clone aDirectory from the svn

git svn fetch svn-extra

And try to get the previous one with new one already in your repo

git svn fetch --fetch-all

Probably this could help git-svn to understand this atypical commit.

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