[英]How do I make git-svn use a particular svn branch as the remote repository?
A word of warning: I'm a n00b to git
in general. 一句警告:一般来说,我对
git
是个傻瓜。 My team uses feature branches in svn
, and I'd like to use git-svn
to track my work on a particular feature branch. 我的团队在
svn
使用了功能分支,我想使用git-svn
来跟踪我在特定功能分支上的工作。 I've been (roughly) following Andy Delcambre's post to set up my local git
repo, but those instructions seem to have led git
to pick the svn
branch that had changed most recently as the remote repository; 我一直(大致)跟随Andy Delcambre的帖子来设置我的本地
git
repo,但这些指令似乎已经让git
选择了最近作为远程存储库更改的svn
分支; the problem is that's not the branch I care about. 问题是,这不是我关心的分支。 How do I control which branch
git-svn
uses? 如何控制
git-svn
使用哪个分支? Or am I approaching this completely wrong? 或者我接近这个完全错误?
UPDATE: I did use the -T
, -b
, and -t
options (in my case because the svn
repo has multiple projects, but I want the git
repo to contain only the project I'm working on). 更新:我确实使用了
-T
, -b
和-t
选项(在我的情况下,因为svn
repo有多个项目,但我希望git
repo只包含我正在处理的项目)。
Muchas gracias to Bart's Blog for this handy reference for svn branches in git . Muchas gracias到Bart的博客, 为git中的svn分支提供了这个方便的参考 。 Apparently all I needed was to specify a remote branch when creating the
git
branch, eg, 显然我只需要在创建
git
分支时指定远程分支,例如,
git checkout -b git-topic-branch-foo foo
where foo
is the name of the remote branch. 其中
foo
是远程分支的名称。
You might also have a look at this: git-svn is a gateway drug - robby on rails . 你可能也看看这个: git-svn是一个网关毒品 - robby on rails 。
I used something like this when I needed to make sure that my local branch was pointing to the correct remote svn branch: 当我需要确保我的本地分支指向正确的远程svn分支时,我使用了类似的东西:
git branch -r
to get the name of the remote branch I want to be tracking. 获取我想要跟踪的远程分支的名称。 Then
然后
git reset --hard remotes/svn-branch-name
to explicitly change my local branch to point to a different remote branch. 显式更改我的本地分支以指向不同的远程分支。
我需要首先运行'git svn fetch',因为我想要关联的分支是在我的git客户端之后创建的。
I use git-svn but I haven't used the features that interoperate with SVN branches. 我使用git-svn,但我没有使用与SVN分支互操作的功能。 Having said that, I notice that the tutorial you were following didn't use the -T, -b, -t options to git svn init.
话虽如此,我注意到您所关注的教程没有使用-T,-b,-t选项来git svn init。 These options tell git-svn what the upstream trunk/branches/tags directories are named, which might be important in your situation.
这些选项告诉git-svn命名上游trunk / branches / tags目录,这在你的情况下可能很重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.