繁体   English   中英

git-svn:如何通过git创建一个新的svn分支?

[英]git-svn: how do I create a new svn branch via git?

我有一个跟踪svn存储库的git存储库。 我使用--stdlayout克隆它。

我通过git checkout -b foobar创建了一个新的本地分支

现在我希望这个分支最终在svn存储库中的…/branches/foobar中。

我该怎么做?

(剪了很多调查文本。如果你关心,请查看问题历史)

我知道这个问题已经回答了一段时间,但在阅读之后,我可能会帮助添加特定git svn分支命令的示例并将其与典型的工作流程联系起来。

像kch一样回答,使用git svn branch 这是一个完整的例子,(注意-n用于干运行测试):

git svn branch -n  -m "Branch for authentication bug" auth_bug

如果这很顺利,服务器会回答这样的答案:

复制https://scm-server.com/svn/portal/trunk在r8914到https://scm-server.com/svn/portal/branches/auth_bug ...

如果没有-n开关,服务器可能会添加如下内容:

找到可能的分支点: https//scm-server.com/svn/portal/trunk => https://scm-server.com/portal/branches/auth_bug,8914

找到分支父母:(refs / remotes / auth_bug)

d731b1fa028d30d685fe260f5bb912cbf59e1971

以下是do_switch的父级

成功跟随父母r8915 = 6ed10c57afcec62e9077fbeed74a326eaa4863b8

(参考文献/遥控器/ auth_bug)

最好的部分,现在你可以根据你的远程分支创建一个本地分支,如下所示:

git checkout -b local/auth_bug auth_bug

这意味着“检查并创建名为auth_bug本地分支,并使其跟随远程分支(最后一个参数) auth_bug

测试您的本地分行通过使用适用于远程分支dcommit--dry-run-n ):

git svn dcommit -n

SVN服务器应该回复新的分支名称:

致力于https://scm-server.com/svn/portal/branches/auth_bug ...

从git v1.6.1开始, git svn branch可用。

从git文档:

branch
        Create a branch in the SVN repository.

        -m, --message
            Allows to specify the commit message.

        -t, --tag
            Create a tag by using the tags_subdir instead of the branches_subdir
            specified during git svn init.

以前版本的git不提供创建svn分支的方法。

@kch我只是(2008年12月7日)编译了git的v1.6.1-rc1标签,它确实包含了git svn branch命令及其文档。 所以git的v1.6.1版本应该(希望)包含这个命令。

暂无
暂无

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

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