简短问题:git-svn相当于svn up -r r1130
只更新为编号提交(带有svn编号)?
我正在使用git-svn所以我可以使用git和管理(许多)我团队的svn存储库的本地分支。我有一个版本的软件,我讨厌使用特定的硬件设置。自从我上次使用它以来,svn repo已经超越了这项工作的稳定,优点。我想将本地分支更新为表示稳定提交的编号修订。我可以使用svn up -r r1130
在svn中执行此操作,但我更喜欢git。
我一直忘记过去我是如何做到这一点的,并且发现自己正在搜索SO和寻求最佳方式的帮助页面。也许我缺少一个措辞不同的Q& A?
在一棵干净的树上查看旧修订版很容易,但是当我在树顶上进行提交时,“重绕头部重放你的工作......”是我的一部分通常爱意味着我会在添加更改之前到达树中的某个点!
现在,我要去git svn rebase
,然后以交互方式重新设置以退出我不想要的提交,但我很难相信这是做到这一点的最好甚至是好方法。 / p>
答案 0 :(得分:18)
我更喜欢rebase
,因为git-svn无论如何都要在dcommit
之前重新定义你的更改。试试这个:
git checkout `git svn find-rev r1241` # Go to the svn version of interest
git checkout -b master_r1241 # Create a new brach matching it
git checkout hwTesting # Merge previously created changes
git rebase master_r1241 # rebase on top of not quite up-to-date master branch
你也可以一步完成:(如果事情出现严重错误,可以使用reflog或rebase --abort
恢复)。
git checkout hwTesting # Checkout feature branch
git rebase `git svn find-rev r1241` # rebase on top of not quite up-to-date master branch
答案 1 :(得分:1)
似乎没有一步到位的方法。但是,您可以轻松找到给定svn修订号的相应git commit id。试试这个:
git svn find-rev rN
其中N是您想要的修订号。之后,使用git checkout签出历史记录中的特定点。
答案 2 :(得分:0)
我会留下这个作为参考,因为接受的答案提到了它。尽管使用单线条rebase选项......
这是我现在正在做的事情。这次我从r1130(在问题中提到)升级到r1241:
git checkout `git svn find-rev r1241` # Go to the svn version of interest
git checkout -b hwTesting_r1241 # Create a new brach matching it
git merge hwTesting_r1130 # Merge previously created changes
这主要是给了我想要的东西,但每次更新时它都会产生另一个分支。似乎应该有一些方法告诉git只合并master上的提交,包括git svn find-rev r1241
返回的提交。