Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have local Git branches working with remote SVN repositories?

Tags:

git

svn

We have a SVN repository with our source code. We really want to use local Git branches to develop new features and take advantage of Git capabilities like the merging algorithms.

Is that possible? If yes, could someone provide some information about how to perform that?

like image 437
gustavodidomenico Avatar asked Jan 25 '13 17:01

gustavodidomenico


1 Answers

Yes. You will need to use git-svn.

First you will need to git svn clone your SVN repository. Note that this will fetch every revision from the SVN server, and recreate the history as a Git repository. These Git repositories should not be shared by multiple developers. Each developer should run git svn clone individually!

Then you can create local branches all you want using standard Git commands, since you basically have a standard Git repository with some extra SVN metadata for tracking SVN commits. You can use commands like git svn dcommit to push commits in Git to the SVN server (each Git commit would become a separate SVN commit).

I would consider reading a good git-svn tutorial.

(If possible, you might also consider whether you would actually rather use git-svn to convert your SVN repository to a Git repository, and then discontinue use of SVN altogether.)

like image 188
cdhowie Avatar answered Nov 15 '22 22:11

cdhowie