简体   繁体   English

Subgit:避免将git分支同步到svn上

[英]Subgit: avoid to synchronize git branches onto svn

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. 我正在尝试使用SubGit但是我遇到了分支的问题:我希望在Git下创建的分支只能在Git中生存和死亡。 I found this: SubGit: How to exclude branches? 我发现了这个: SubGit:如何排除分支? , 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. . 麻烦来自合并提交:如果提交A是将分支foo合并到主服务器的结果,则SubGit在Subversion端为commit A的相应父服务创建分支/ foo。 If you'd prefer to not include SubGit generated branches into branches/* namespace, consider using some special branches on Subversion side as well 如果您不希望将SubGit生成的分支包含到branches / * namespace中,请考虑在Subversion端使用一些特殊的分支

I don't want to mess with the SVN because I am evaluating Subgit and I don't want to change anything on SVN. 我不想搞乱SVN,因为我正在评估Subgit而且我不想在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. 我想我可以在推送到Git存储库之前通过重新定位来实现我的目标(意思是,仅提交SVN合并历史而不是git分支),但我担心这会在返回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 2.1版(声称做我想要的但不是在不久的将来 - 来自链接的答案: it's going to take some time before we implement it )?

SubGit synchronizes only branches you've specified in the SubGit config file. SubGit仅同步您在SubGit配置文件中指定的分支。 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, eg refs/heads/nosync/*, branches in it won't be synchronized. 因此,如果您使用另一个命名空间,例如refs / heads / nosync / *,则其中的分支将不会同步。

Or you can use refs/heads/* for normal branches (that are out of synchronization) and setup special refs/heads/sync/* namespace for synchronization: 或者您可以将refs / heads / *用于普通分支(不同步)并设置特殊的refs / heads / sync / *命名空间以进行同步:

    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. 请注意,长分支名称(如refs / heads / sync / master)不会带来不便,因为在克隆此类Git存储库后,您可以使用短名称分配自己的本地refs / heads / *分支来跟踪具有长名称的分支从一个或另一个命名空间。 That's why I think this is a good solution for you. 这就是为什么我认为这对你来说是一个很好的解决方案。

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

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