简体   繁体   English

git-svn不承诺分支,只有trunk

[英]git-svn isn't committing to branches, only trunk

I'm working with an SVN repository that is laid out like this: 我正在使用如下布局的SVN存储库:

$SVN/[project]/trunk
$SVN/[project]/branches/[user]/[branch]
$SVN/[project]/tags/releases/[tag]

My .git/config looks like this: 我的.git / config看起来像这样:

[svn-remote "svn"]
  url = $SVN   
  fetch = project/trunk:refs/remotes/trunk   
  branches = project/branches/*/*:refs/remotes/*

When I look at git branch -a, I see all the remote branches. 当我看到git branch -a时,我看到了所有的远程分支。 Let's say I want to check one out, work on it, then commit the changes back. 假设我想检查一个,处理它,然后提交更改。 Here's is what I am trying to do: 这是我想要做的:

git checkout -b comments erik/comments
.... work, commit locally ....
git svn dcommit

However, dcommit always pushes to $SVN/project/trunk. 但是,dcommit总是推送到$ SVN / project / trunk。 git svn info always reports the URL as $SVN/project/trunk git svn info始终将URL报告为$ SVN / project / trunk

I've tried using --track, I've tried reseting with --hard. 我尝试过使用--track,我尝试用--hard重置。 I'm out of ideas here. 我在这里没有想法。 I suspect it's my [svn-remote], but that's just a hunch. 我怀疑这是我的[svn-remote],但这只是一种预感。

Does the branch erik/comments exist in SVN already? SVN中是否存在分支erik/comments

I work as follows: 我的工作如下:

git svn fetch #update any newly created branches
git checkout davec/new-feature # on remote branch, git may warn you
git checkout -b new-feature davec/new-feature # assumes this exists in SVN
# hack
# commit
git svn dcommit

I realize that git checkout -b local remote is a one-step version of what I do in two steps, however this seems to work. 我意识到git checkout -b local remote是我分两步执行的一步式版本,但这似乎有效。

Another option is to replace your config with your username, eg 另一种选择是用您的用户名替换您的配置,例如

branches = project/branches/erik/*:refs/remotes/*

And then 然后

git checkout new-feature # remote branch
git checkout -b new-feature-branch # local

It looks like this did more-or-less what I'm looking for: Cloning a Non-Standard Svn Repository with Git-Svn 它看起来像我正在寻找的或多或少: 用Git-Svn克隆非标准的Svn存储库

I still have an issue with some changes not showing up, but that's for another day. 我仍然有一些问题,一些变化没有出现,但那是另一天。 Thanks everyone! 感谢大家!

You could try svn2git, and git2svn , as they do take into account non-standard SVN layouts. 您可以尝试使用svn2git和git2svn ,因为它们会考虑非标准的SVN布局。

They do use the --tags and --branches parameters of git svn , and even if you do not use the scripts I mentioned above, you can use those parameters to get the data in the right places in your svn repository. 他们确实使用git svn--tags--branches参数,即使你不使用我上面提到的脚本,你也可以使用这些参数将数据放在svn存储库的正确位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM