git-svn branch-如何保持分支与中继同步? [英] git-svn branch - How to keep branch in sync with trunk?

查看:140
本文介绍了git-svn branch-如何保持分支与中继同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于git-svn工作流程有很多问题,但我无法弄清楚这一点:

There are plenty of questions about git-svn workflow, but I haven't been able to figure this one out:

这部分svn图书讨论了一个常见的SVN的实践:您创建了一个分支,并且随着主干的更新而不断合并主干中的更改,以便该分支始终包含最新的更改。

This section of the svn book talks about a common practice with SVN: you make a branch, and you keep merging changes from the trunk as the trunk gets updated, so that the branch always includes the latest changes.

git svn branch 在svn上创建一个分支,然后设置一个跟踪分支以对其进行处理。 这些 问题

I did git svn branch to create a branch on svn and then set up a tracking branch to work on it. These questions cover the process pretty well.

现在假设对主干进行了更改,现在我想将其合并到分支中。我最好的选择是什么?请注意,我需要保持git-svn的快乐,并且不要弄乱使用带有subversion的分支的人的工作,因此仅进行重新设置可能就行不通了。

Now suppose there were changes made to the trunk, which I now want to merge into the branch. What is my best option? Note that I need to keep git-svn happy, and not mess up the work of people using the branch with subversion, so just doing a rebase would probably not work.

这个问题似乎在讲类似的情况,尽管它已经很老了,我不确定到底有什么底线-似乎建议我先 git checkout master ,然后再 git rebase mybranch ,但这不可能是正确的。

This question seems to talk about a similar situation, although it's pretty old, and I'm not sure what the bottom line there was - it seems to suggest I should git checkout master and then git rebase mybranch, but that can't be right.

我怀疑答案应该是具有 svn merge ,最好设置 mergeinfo 属性,但是可惜没有 git svn merge 。 ..

I suspect the the answer should be something that has the effect of svn merge, preferably with setting the mergeinfo property, but alas, there is no git svn merge...

推荐答案

我真的不明白,这个简单的问题有一个多星期没有得到回答,只有13次浏览至今。我想这是我的错,很糟糕的问题写作。

I don't really understand how this simple question was left unanswered for more than a week, with only 13 views so far. I guess it was my fault, bad question writing.

无论如何,我自己弄清楚了。简短版本:只需使用 git merge 而不是 git rebase

Anyway, I figured it out myself. Short version: just use git merge instead of git rebase.

我的困惑来自将分支与master的更改同步时使用 git rebase 。在本地分支机构工作时,这通常效果很好,并且可以使历史保持整洁。但是,您不应为已推送到公共存储库的提交提供基准,并且Subversion存储库(大概)是足够公开的。另一方面, git merge 效果很好,没有任何问题。

My confusion came from using git rebase when syncing a branch with the changes in master. When working on local branches, this usually works great, and keeps the history clean. However, you should not rebase commits that you have pushed to a public repository, and the subversion repository is (apparenly) public enough. git merge, on the other hand, works beautifully, and doesn't have any problem.

因此,长答案是:当您要将中继中的最新更改合并到要跟踪的svn分支中时,只需执行以下操作:

So, the long answer is: when you want to merge the latest changes in the trunk into the svn branch you're tracking, just do:

git merge master
# Handle conflicts, git add when you're done
git commit
git svn dcommit

这将使您的分支与主干保持同步,但不会设置mergeinfo,因此您不应该在此混用 svn merge 一种练习。

This will keep your branch in sync with trunk, but will not set mergeinfo, so you probably should not mix svn merge with this kind of practice.

这篇关于git-svn branch-如何保持分支与中继同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆