我正在使用git-svn来跟踪同一个svn存储库中的多个分支.通常情况下这很好,但今天我已经完成了一些重置和重新设置,突然我的分支机构不会再向正确的远程分支发送:
$ git branch
* master
a
b
$ git svn dcommit -n
Committing to svn://server/repo/trunk ...
$ git checkout a
$ git svn dcommit -n
Committing to svn://server/repo/branches/a ...
$ git checkout b
$ git svn dcommit -n
Committing to svn://server/repo/branches/a ...
Run Code Online (Sandbox Code Playgroud)
所以分支b将提交到branches/a目录而不是branches/b目录.
我试过更改跟踪的分支:
$ git branch --set-upstream b remotes/b
Run Code Online (Sandbox Code Playgroud)
和其他东西,但唯一有效的解决方案是删除分支b并重新创建它:
$ git branch -D b
$ git branch b remotes/b
$ git svn dcommit -n
Committing to svn://server/repo/branches/b ...
Run Code Online (Sandbox Code Playgroud)
现在我的问题是:git svn如何确定要提交的目录?我该如何修改这个目录?
谢谢,
乔纳斯
您要查找的SVN配置位于克隆存储库的.git/config文件中.它可以使用文本编辑器进行操作.这是一个示例:
$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[svn-remote "svn"]
url = https://pdfsam.svn.sourceforge.net/svnroot/pdfsam
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*
Run Code Online (Sandbox Code Playgroud)
假定分支默认匹配name-to-name.要跟踪不匹配的分支名称,请重命名本地分支或为奇怪命名的分支添加显式配置(远程):
[svn-remote "weirdbranch"]
url = svn+ssh://ambientideas.com/svnrepos/myproject/branches/myweirdbranch
fetch = :refs/remotes/git-svn-myweirdbranchlocalname
Run Code Online (Sandbox Code Playgroud)
此外,如果执行来自多个SVN repos的分支的Git合并,则dcommit意志(逻辑上,但对第一次用户感到困惑)将定位第一个合并提交父级的SVN URL.Git文档声明"git svn dcommit将尝试在名为的SVN提交之上提交git log --grep=^git-svn-id: --first-parent -1"
如果将一个SVN分支重新绑定到另一个SVN分支,这意味着"最新"提交(从属分支)将成为该目标dcommit.通常,用户想要定位主导SVN仓库(分支).这要求用户在重新定位时使用该--no-ff选项,以确保最后一次提交指向主导分支(新挑选的新提交).
其他相关的StackOverflow问题包括:
| 归档时间: |
|
| 查看次数: |
2942 次 |
| 最近记录: |