SubGit: How to exclude branches?

I am testing SubGit as a way to migrate from SVN to Git.

What I would like to do is create remote branches in the git repository so that all users can use this non- synchronization with SVN.

I need SubGit to track the main branch and synchronize it with SVN so that we have the freedom to use and share other git branches.

Is there an easy way to do this?

thanks

+6
source share
1 answer

The ideal solution would be to specify trunk: refs / heads / master mapping to configure SubGit , so SubGit will synchronize the trunk with the master, ignoring any other branches.

Unfortunately, SubGit requires at least one branch mapping at the moment (versions 1.0.x and 2.0.x). That is, you need to specify something like this:

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

Since you are not going to sync all Git branches, consider using a special namespace to fix the problem:

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

Thus, if one pushes the main branch into the central Git repository, it is transferred to the trunk. However, if someone clicks on the foo branch, SubGit ignores this branch, as refs / heads / foo goes out of sync.

Merging issues arise: if commit A is the result of merging the foo branch into master, then SubGit creates the / foo branches on the Subversion side for the corresponding commit A. parent. If you prefer not to include the generated SubGit branches in * names / ** namespace, consider also use of some special branches on the Subversion side:

 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 element commit A should be sent to the gitsvn / branch / foo branch.

This is the best solution available at the moment. We also have a feature request for version 2.1, which will allow you to choose the perfect solution, but it will take some time before we implement it.

Update on SubGit 3.0:

Starting with version 3.0.0 (the early access phase is currently uploaded to http://subgit.com/eap ) SubGit supports the layout of one branch, so the configuration file may look like this:

  • No trunk, no branches, no tags and shelves:

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

    In this case, the project directory is displayed directly in the master branch in the Git repository; SubGit ignores any other branches and never creates shelves, which means that anonymous Git branches are not synchronized with SVN.

  • Separate trunk, shelves:

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

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

  • Separate trunk with shelves:

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

    In this case, the project / trunk directory maps to the master branch in the Git repository; SubGit ignores any other branches, but transfers anonymous branches to the default shelves for versions 1.0.x and 2.0.x.

Hope this helps.

+7
source

Source: https://habr.com/ru/post/945167/


All Articles