Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert an SVN checkout to use git (git-svn)

I work with software that is kept in svn for version control. I would like to use git (git-svn) however the software requires lots of setup and configuration before it can be used. There are tools that take care of all of the setup, including checking out all the code via svn.

All the documentation for git-svn (I've been able to find) requires a fresh checkout, using git-svn.

Is there a way to convert an existing svn checkout so it can use git-svn?

like image 713
Jachin Avatar asked May 05 '09 20:05

Jachin


People also ask

Is git clone same as SVN checkout?

git clone is more of an analogue to svn checkout than git checkout . git checkout just checks out a branch or commit from your local repository. git clone makes a new copy of a remote repository. +1, Just to emphasize, in 99% of case you'd do an svn checkout you'd need a git clone .

Can you use git with SVN?

The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.

How do I migrate an SVN repository with history to a new git repository?

Prepare a migration environment. Convert the source SVN repository to a local Git repository. (Optional) Synchronize the local Git repository with any changes from SVN repository while developers continue using SVN. Push the local Git repository to a remote Git repository hosted on Azure Repos.


2 Answers

No. A git-svn clone converts the entire repository into git. SVN checkouts do not have the entire repository and so cannot be cloned from. This is the primary advantage of switching from SVN or CVS to a distributed system (like git).

like image 78
singpolyma Avatar answered Oct 09 '22 09:10

singpolyma


You could do something like this:

  1. Do a full clone of your SVN tree using git-svn, to a temporary directory. Make sure you use the exact same revision as your existing checkout.
  2. Move the ".git" folder from the top level of the git-svn checkout into the top level of the SVN checkout.
  3. Then you'll either need to tell Git to ignore the ".svn" directories, or you can delete them all.
  4. Delete the git-svn checkout.
  5. There, now you can manipulate your existing files with Git and git-svn.
  6. Do a "git status" and hope that it says there are no changes.
like image 34
andy Avatar answered Oct 09 '22 09:10

andy