将 git dcommits 切换到 svn 分支

发布于 2024-11-25 04:45:30 字数 750 浏览 3 评论 0原文

我有 master dcommit 到 Subversion trunk(以及 rebase)。

我创建了一个中间 Subversion 分支 tc,以合并来自 2 个不同分支的更改,使用:

git branch master
git svn branch tc -m "Branch for merging"
git checkout -b tcl --track tc
git merge cat #Another branch, whose changes I merged here
git commit -m 'Merged changes from cat branch'
git svn dcommit

由于一切都很好,我想将其提升到 trunk。我接着做:

git branch master
git merge tcl
git svn dcommit

现在,因为 master 是从另一个指向不同 Subversion 分支的分支合并的,所以它尝试提交到 Subversion 分支 tc。我希望它提交到 Subversion trunk

是否有 git svn switch 或类似的东西?

我知道我的工作流程不是最佳的,也欢迎任何改进它的建议。

I had master dcommit to (and rebase from) the Subversion trunk.

I created an intermediate Subversion branch tc, to merge changes from 2 different branches, using:

git branch master
git svn branch tc -m "Branch for merging"
git checkout -b tcl --track tc
git merge cat #Another branch, whose changes I merged here
git commit -m 'Merged changes from cat branch'
git svn dcommit

Since everything was fine, I wanted to promote this to the trunk. I followed doing:

git branch master
git merge tcl
git svn dcommit

Now, because master was merged from another branch that was pointing to a different Subversion branch, it tries to commit to the Subversion branch tc. I want it committed to the Subversion trunk.

Is there a git svn switch or something like that?

I know my workflow is not the optimal and any suggestions to improve it are welcome too.

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

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

发布评论

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

评论(2

羁绊已千年 2024-12-02 04:45:30

这个问题,在带有 git-svn 的存储库中使用 git merge 并不是一个好主意。

相反,您应该做的是将更改“合并”到 master 中:

git checkout master
git format-patch --stdout master..tcl | git am
git svn dcommit

在这种情况下 git merge 的问题是它还设置了 git- svn master 到 SVN tc 分支的 URL。 format-patcham 组合仅接受更改本身。

As mentioned in this question, using git merge in a repository with git-svn is not a good idea.

Instead, what you should have done to "merge" the changes into master is:

git checkout master
git format-patch --stdout master..tcl | git am
git svn dcommit

The problem with git merge in this case is that it also sets the git-svn URL for master to the SVN tc branch. The format-patch and am combination only takes the changes themselves.

苦行僧 2024-12-02 04:45:30

AFAIK --no-ff 合并会按照您想要的方式进行:

git branch master
git merge --no-ff tcl
git svn dcommit

AFAIK a --no-ff merge would have gone the way you want:

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