SubGit:如何排除分支? [英] SubGit: How to exclude branches?

查看:177
本文介绍了SubGit:如何排除分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在测试SubGit作为从SVN迁移到Git的一种方式。



我想要做的是能够在git仓库中创建远程分支所有用户都可以使用同步回SVN。



我只希望SubGit跟踪主分支并将其同步回SVN,以便我们可以自由使用和共享其他Git分支。



有没有一种简单的方法可以做到这一点?



谢谢

解决方案

理想的解决方案是在 trunk:refs / heads / master 映射rel =nofollow> SubGit配置,所以SubGit会同步 trunk master 忽略任何其他分支。



不幸的是,SubGit目前至少需要一个分支映射(版本1.0.x和2.0.x)。也就是说,必须指定如下所示:

  trunk = trunk:refs / heads / master 
branches =分行/ *:参考/头/ *
货架=货架/ *:参考/货架/ *
标签=标签/ *:参考/标签/ *



由于您不会同步所有Git分支,请考虑使用一些特殊的命名空间来解决问题:

  trunk = trunk:refs / heads / master 
branches = branches / *:refs / gitsvn / heads / *
...

因此,如果将master 分支推送到中央Git存储库,它将转换为躯干。但是,如果推送分支 foo ,则由于 refs / heads / foo 不同步,SubGit会忽略该分支。



麻烦来自合并提交:如果提交A是将分支 foo 合并到 master 中的结果,则SubGit会创建 branches / foo 在Subversion一侧提供相应的提交A的父项。如果你不想将SubGit生成的分支包含到* branches / **命名空间中,可以考虑在Subversion一侧使用一些特殊的分支:

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

在这种情况下,应该将同一个提交A的父母发送到 gitsvn / branches / foo 分支。



这是目前可用的最佳解决方案。我们还为2.1版本提供了一项功能请求,可为您提供理想的解决方案,但在实施之前还需要一段时间。



SubGit 3.0:



自3.0.0版本(此刻的早期访问阶段,请在 http://subgit.com/eap )SubGit支持单个分支布局,因此配置文件可能如下所示:


  1. 没有主干,没有分支,没有标签也没有货架:

      [svn] 
    url = http://host.com/repos/project

    在这种情况下, project 目录直接映射到Git仓库中的 master 分支; SubGit忽略任何其他分支,从不创建货架,这意味着匿名Git分支不会同步到SVN。

  2. 单一主干,没有货架:

      [svn] 
    url = http://host.com/repos/project
    trunk = trunk:refs /头/主

    在这种情况下,project / trunk 目录被映射到 master 分支在Git仓库中; SubGit会忽略任何其他分支并且不会创建货架。

  3. 带货架的单行李箱:

      [svn] 
    url = http://host.com/repos/project
    trunk = trunk:refs / heads / master
    shelf = shelves / *: refs / shelves / *

    在这种情况下, project / trunk 目录是映射到Git仓库中的 master 分支; SubGit忽略任何其他分支,但默认情况下它将匿名分支转换为版本1.0.x和2.0.x。




<希望有所帮助。


I'm testing SubGit as a way of migrating from SVN to Git.

What I would like to do is be able to create remote branches in the git repository that all users can use that does not sync back to SVN.

I only want SubGit to track the master branch and sync it back to SVN so that we have the freedom to use and share other Git branches.

Is there a simple way to do this?

Thank you

解决方案

The ideal solution would be specifying trunk:refs/heads/master mapping in SubGit configuration, so SubGit would synchronize trunk with master ignoring any other branches.

Unfortunately, SubGit needs at least one branches mapping at the moment (versions 1.0.x and 2.0.x). That is, one has to specify something like this:

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

Since you're not going to synchronize all the Git branches, consider using some special namespace to workaround the issue:

trunk = trunk:refs/heads/master
branches = branches/*:refs/gitsvn/heads/*
...

So, if one pushes master branch to central Git repository, it gets translated to trunk. However, if one pushes branch foo, SubGit ignores that branch since refs/heads/foo is out of sync scope.

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:

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

In this case the same parent of commit A should be sent to gitsvn/branches/foo branch.

This is the best solution available at the moment. We also have a feature request for version 2.1 that would enable an ideal solution for you, but it's going to take some time before we implement it.

Update on SubGit 3.0:

Since version 3.0.0 (early access stage at the moment, download at http://subgit.com/eap) SubGit supports single branch layout, so configuration file may look as follows:

  1. No trunk, no branches, no tags and no shelves:

    [svn]
        url = http://host.com/repos/project
    

    In this case, project directory is mapped directly to master branch in Git repository; SubGit ignores any other branches and never creates shelves which mean anonymous Git branches don't get synced to SVN.

  2. Single trunk, no shelves:

    [svn]
        url = http://host.com/repos/project
        trunk = trunk:refs/heads/master
    

    In this case, project/trunk directory is mapped to master branch in Git repository; SubGit ignores any other branches and never creates shelves.

  3. Single trunk with shelves:

    [svn]
        url = http://host.com/repos/project
        trunk = trunk:refs/heads/master
        shelves = shelves/*:refs/shelves/*
    

    In this case, project/trunk directory is mapped to master branch in Git repository; SubGit ignore any other branches but it translates anonymous branches to shelves as by default for versions 1.0.x and 2.0.x.

Hope that helps.

这篇关于SubGit:如何排除分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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