Subgit:避免将git分支同步到svn [英] Subgit: avoid to synchronize git branches onto svn

查看:276
本文介绍了Subgit:避免将git分支同步到svn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用 SubGit ,但我面临分支机构的问题:我想要在Git下创建的分支机构只能在Git中生存和死亡。我发现这个: SubGit:如何排除分支?,但它说


麻烦来自合并提交:如果提交A是将分支foo合并到主机中的结果,则SubGit会在Subversion侧创建分支/承诺的父母A.如果你不想将SubGit生成的分支包含到分支/ *命名空间中,可以考虑在Subversion端使用一些特殊的分支

我不想与SVN混淆,因为我正在评估Subgit,并且我不想在SVN上更改任何内容。我想我可以通过 rebasing ,然后推送到Git存储库,但是恐怕这会在提交回SVN时导致冲突。任何关于如何解决这个问题的想法,无需等待SubGit版本2.1(声称做我想做但不会在不久的将来 - 从相关答案中提出:在我们实现它之前需要一段时间)?

解决方案

SubGit仅同步您在SubGit配置文件中指定的分支。默认情况下它们是:

$ $ p $ code trunk = trunk:refs / heads / master
branches = branches / *:refs /头/ *
货架=货架/ *:裁判/货架/ *
标签=标签/ *:裁判/标签/ *

所以如果你使用另一个命名空间,例如refs / heads / nosync / *,其中的分支将不会同步。



或者你可以使用refs / heads / *作为正常分支)并设置用于同步的特殊参考/头部/同步/ *命名空间:

  trunk = trunk:refs / heads / sync / master 
branches = branches / *:refs / heads / sync / *
shelfs = shelves / *:refs / shelves / *
tags = tags / *:refs / tags / sync / *

请注意,长分支名称(如refs / heads / sync / master)不会导致不便因为在克隆这样的Git仓库之后,您可以为自己的本地refs / heads / *分支指定短名称,以便从一个或另一个名称空间跟踪具有长名称的分支。这就是为什么我认为这是一个很好的解决方案。


I am trying to use SubGit but I am facing a problem with branches: I would like branches created under Git to live and die inside Git only. I found this: SubGit: How to exclude branches?, but it says

The troubles come from merge commits: if commit A is the result of merging branch foo into master, then SubGit creates branches/foo on Subversion side for corresponding parent of commit A. . If you'd prefer to not include SubGit generated branches into branches/* namespace, consider using some special branches on Subversion side as well

I don't want to mess with the SVN because I am evaluating Subgit and I don't want to change anything on SVN. I guess I could my goal (meaning, committing to SVN only the merged history and not also the git branch) by rebasing before pushing to the Git repository, but I am afraid this could lead to conflicts when committing back to SVN. Any idea on how I can workaround this, without waiting for SubGit version 2.1 (claimed to do what I want but not in a near future - cit from linked answer: it's going to take some time before we implement it)?

解决方案

SubGit synchronizes only branches you've specified in the SubGit config file. By default they are:

    trunk = trunk:refs/heads/master
    branches = branches/*:refs/heads/*
    shelves = shelves/*:refs/shelves/*
    tags = tags/*:refs/tags/*

So if you use another namespace, e.g. refs/heads/nosync/*, branches in it won't be synchronized.

Or you can use refs/heads/* for normal branches (that are out of synchronization) and setup special refs/heads/sync/* namespace for synchronization:

    trunk = trunk:refs/heads/sync/master
    branches = branches/*:refs/heads/sync/*
    shelves = shelves/*:refs/shelves/*
    tags = tags/*:refs/tags/sync/*

Note, that long branch names (like refs/heads/sync/master) don't lead to inconvenience because after cloning such Git repository, you can assign your own local refs/heads/* branches with short names to track branches with long names from one or another namespace. That's why I think this is a good solution for you.

这篇关于Subgit:避免将git分支同步到svn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆