views:

86

answers:

1

At work we are using a lot of branches in SVN and there are problems in merging. I heard that a good idea is to use git better merging with git-svn. I try to play with it using msysgit, however its not as easy as it seems.

I know I can checkout the whole project using git svn clone -s, however it does not see branches(as normal git branches). I find git-svn very hard to use compare to git or svn.

Could you describe in steps how to do that kind of merging?

+3  A: 

git-svn will gives you a branches for each branches and tag in SVN (unless you use a ruby script like svn2git)

The idea is to always git-svn rebase / git-svn dcommit a SVN branch.
ie, you will synchronize a Git branch with a SVN one (git-svn rebase), and you will update an SVN branch from the new commits in the corresponding Git branch (git-svn dcommit).

Any local Git branches, with all their fancy merges, must be local (i.e. all those branches/merges in Git won't have any equivalent in the SVN repo)

As the caveat in the git-svn goes (see the SO question "git-svn merge 2 svn branches"):

For the sake of simplicity and interoperating with a less-capable system (SVN), it is recommended that all git svn users clone, fetch and dcommit directly from the SVN server, and avoid all git clone/pull/merge/push operations between git repositories and branches.
The recommended method of exchanging code between git branches and users is git format-patch and git am, or just 'dcommit'ing to the SVN repository.

Running git merge or git pull is NOT recommended on a branch you plan to dcommit from.
Subversion does not represent merges in any reasonable or useful fashion; so users using Subversion cannot see any merges you've made. Furthermore, if you merge or pull from a git branch that is a mirror of an SVN branch, dcommit may commit to the wrong branch.

VonC