首页 文章

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

提问于
浏览
6

我正在使用如下布局的SVN存储库:

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

我的.git / config看起来像这样:

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

当我看到git branch -a时,我看到了所有的远程分支 . 假设我想检查一个,处理它,然后提交更改 . 这是我想要做的:

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

但是,dcommit总是推送到$ SVN / project / trunk . git svn info 始终将URL报告为$ SVN / project / trunk

我尝试过使用--track,我尝试用--hard重置 . 我在这里没有想法 . 我怀疑这是我的[svn-remote],但这只是一种预感 .

3 回答

  • 2

    您可以尝试svn2git, and git2svn,因为它们会考虑非标准SVN布局 .

    它们确实使用git svn--tags--branches 参数,即使您不使用我上面提到的脚本,您也可以使用这些参数将数据放在svn存储库中的正确位置 .

  • 0

    看起来这或多或少都是我正在寻找的东西:Cloning a Non-Standard Svn Repository with Git-Svn

    我仍然有一些问题,有些变化没有出现,但那是另一天 . 感谢大家!

  • 1

    分支 erik/comments 是否已存在于SVN中?

    我的工作如下:

    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
    

    我意识到 git checkout -b local remote 是我分两个步骤的一步式版本,但这似乎有效 .

    另一种选择是用您的用户名替换您的配置,例如

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

    然后

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

相关问题