Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using git with subversion

Tags:

git

svn

CentOS 5.3 subversion 1.4.2

I have been using git for one of my projects.

However, our company policy has changed and now I have to import my git project into our new subversion repository.

I am just wondering how I can import a project created in git into a subversion repository?

Ater I have imported the project I will have to checkout. However, I would still rather use the git commands and not subversion commands, if that is possible?

Many thanks for any suggestions,

like image 335
ant2009 Avatar asked Sep 06 '25 03:09

ant2009


1 Answers

Git can use an external svn repository: http://git-scm.com/docs/git-svn

The main commands you must know are:

  • git svn rebase (better than merge in order to keep the history line)
  • git svn dcommit (equivalent to "git push" with a SVN distant repo)

For the complete push process:

  1. Create a SVN repo for your project
  2. Connect your local Git repo to the distant SVN: git svn init -s svn://svnurl/ (if you have a standard SVN repo with a "trunk", a "branches", and a "tags" directories), or specifying theses directories with "-T trunkdir -t tagsdir -b branchesdir"
  3. From your git repo, use git svn dcommit to push your project to SVN. If your project is big, this can be very long (all your local commits are re-played on SVN to keep the global project history)

After that, you can still work with Git in local (if your company policy isn't too strict), and synchronize your work with the distant SVN repository (git svn rebase/dcommit).

like image 164
Benoit Courtine Avatar answered Sep 09 '25 18:09

Benoit Courtine