Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push an existing git repository to an existing SVN repository

Tags:

git

svn

git-svn

I have been asked for a school project to submit my work by pushing it to an existing SVN repository. It is an existing repository with some files already there. I have no need for these files or the previous commits.

I have been working on my assignment with a git repository on my. I would like to push my work to the SVN repository without losing any history. How can I do this?

like image 486
Zameer Manji Avatar asked Jan 08 '12 15:01

Zameer Manji


Video Answer


1 Answers

I would do a mix. That is, first clone the svn with git svn. Then in this new repository, you merge your work from your current git repository.

$ git svn clone http://svn.example.com/project/trunk
$ cd trunk
$ git checkout -b mywork
$ git pull /path/to/current/work/repository/.git master

Now you have your work in the mywork branch in the clone from subversion. Time to merge and push.

$ git checkout master
$ git merge mywork
$ git svn dcommit

Enjoy!

like image 167
Loïc d'Anterroches Avatar answered Sep 30 '22 15:09

Loïc d'Anterroches