Search code examples
gitsvnintellij-ideagit-svn

How to switch existing Intellij IDEA projects from SVN to Git SVN


I currently have existing Intellij IDEA projects that are tied to the SVN repository. I'm thinking of switching these projects to use Git SVN because I find the need to have a local version control system when I'm not connected to the SVN repository.

Since Intellij IDEA doesn't provide the Git SVN bridge, I run the following command from the command line to clone the SVN repository to Git:-

git svn clone --stdlayout --username myuser http://svnrepo/myproject -A authors.txt myproject

After cloning the SVN repository, I open the Git-based project using Intellij IDEA. At this point, Intellij IDEA complains about missing version control directories. I found out that Intellij IDEA still remembers the old SVN configuration. Since the project now contains .git directories instead of .svn directories, Intellij IDEA gets confused and it doesn't know how to get connected to any repositories right now.

The only workaround that works for me is to do the following:-

  • Create a brand new project (empty project) in SVN repository.
  • Perform "git svn clone".
  • Create the project using Intellij on it.
  • At this point, Intellij IDEA detects .git directories and prompts me whether to add newly created files into Git.
  • Copy everything from SVN-based project to Git-based project.

That said, I cannot run Git on this Intellij IDEA project on one machine and at the same time use SVN on this Intellij IDEA project on another machine. Both machines must use Git, or else Intellij IDEA will not be able to commit to the version control repository. I'm fine with this and I can use Git in all my machines. However, I'm trying to find a way not to create brand new Git-based projects for all my existing SVN-based projects. This is very tedious because I have quite a few SVN projects that I need to run using Git now.

Is there a better solution for me to switch my SVN projects to Git using Intellij IDEA?

Thanks.


Solution

  • You can select the version control system for the current project from File | Settings | Version Control. The setting is stored in one of the project files (.idea/vcs.xml) so if you don't commit that file to version control, you can use different version control system on different machines.