[英]`git svn rebase` vs `git rebase trunk`
I'm working on a project that uses subversion for their repository. 我正在开发一个将subversion用于其存储库的项目。 Because I need to make some changes that can't be sent to the svn server yet, I started using git svn
so that I could do local checkins. 因为我需要进行一些无法发送到svn服务器的更改,我开始使用git svn
以便我可以进行本地签入。 My setup looks like this: 我的设置如下:
Branches: trunk (tracking svn trunk), master (pretty close to what's in svn), and topic. 分支: trunk(跟踪svn trunk),master(非常接近svn中的内容)和主题。
*------------------ trunk
\
*-----------*--------- master
\
*-------- topic
Workflow: 工作流程:
[on branch master]
$ git svn fetch
$ git svn rebase
$ git checkout -b topic
$ git rebase master
[hack hack hack]
$ git commit -a
[once upstream is ready for my changes]
$ git svn fetch
$ git checkout master
$ git svn rebase
$ git checkout topic
$ git rebase master
$ git svn dcommit
$ git checkout master
$ git svn rebase
$ git branch -d topic
Presuming that no one commits to svn between git svn fetch
and git svn rebase
, Is git svn rebase
run on master basically the same as git rebase trunk
run on master? 假设没有人承诺在git svn fetch
和git svn rebase
之间使用git svn fetch
,那么git svn rebase
在master上运行与在master上运行的git rebase trunk
基本相同吗?
Is there a more sensible workflow to use? 是否有更明智的工作流程? It seems like there's a lot of changing branches and rebasing going on. 似乎有很多变化的分支和变基。 I understand that I want to be able to rebase my work on top of whatever's in svn, but it seems like I'm doing more rebases than are strictly necessary. 我知道我希望能够在svn中的任何内容之上重新设计我的工作,但似乎我做的更多的是不是严格必要的。
Note, from git svn , as detailed in " Why is the meaning of “ours” and “theirs” reversed with git-svn ": 请注意,来自git svn ,详见“ 为什么”我们的“和”他们的“的含义与git-svn相反 ”:
git svn rebase
This fetches revisions from the SVN parent of the current HEAD and rebases the current (uncommitted to SVN) work against it. 这将从当前HEAD的SVN父级获取修订,并针对它重新定义当前(未提交到SVN)的工作。
So you don't need the git svn fetch
before your git checkout master
and git svn rebase
, especially if you track only trunk
(parent of master
). 因此,在git checkout master
和git svn rebase
之前不需要git svn fetch
,特别是如果你只跟踪trunk
( master
父级)。
Second point, the git svn dcommit
would create revisions in SVN for each new commit on master
, but your workflow doesn't show any new commit on master
, only on topic
(which isn't ever merged on master
) 第二点, git svn dcommit
会在SVN上为master
上的每个新提交创建修订,但是你的工作流不显示master
上的任何新提交,只显示topic
(它不会在master
合并)
The OP Sean McMillan comments: OP Sean McMillan评论道:
According to the docs,
git svn dcommit
without a branch specified pushes the commits on the current HEAD, not just onmaster
. 根据文档,没有指定分支的git svn dcommit
在当前HEAD上推送提交,而不仅仅是在master
。 So I commit to SVN from my branch, then rely on agit svn rebase
onmaster
to bring the commits back from SVN. 所以我从我的分支机构提交SVN,然后依靠master
上的git svn rebase
从SVN返回提交。 I abandon thetopic
branch after I'vedcommited
. 在我dcommited
之后,我放弃了topic
分支。 Is this not kosher? 这不是犹太人吗?
He details that: 他详细说明:
I can't sent them to SVN... yet. 我还不能把它们发送到SVN ...... Upstream wants to "freeze" the trunk for a release, meanwhile, I'm working on functionality for the next release. 上游希望“冻结”主干用于发布,同时,我正在为下一个版本开发功能。
But the ultimate question is, " is git rebase trunk master the same as git svn rebase on the master branch? " If it is, then I don't need to be constantly changing my branches, just to rebase my master branch against SVN. 但最终的问题是,“ git rebase trunk master和master分支上的git svn rebase一样吗? ”如果是,那么我不需要经常更改我的分支,只是为了反对我的主分支对抗SVN。 But if it's not, and there's some kind of magic happening when I git svn rebase, I want to know. 但是,如果不是,并且当我git svn rebase时会发生某种魔法,我想知道。
To which I reply: 我回复:
A git svn fetch
followed by a git rebase trunk master
would be the equivalent of a git svn rebase
. git svn fetch
后跟git rebase trunk master
将相当于git svn rebase
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.