Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 653
limc Avatar asked Aug 15 '11 18:08

limc


People also ask

How do I change my repository in IntelliJ?

Commit changes to remote repositoryNavigate to VCS → Subversion → Commit Files option. A new window will appear. Here, you can see the files to be committed to remote respository. Verify the files and click on the Commit button to publish your changes.

How do I get Git options in IntelliJ?

One way to open the Git tool window is to hover over the quick access button in the bottom left of the IntelliJ IDEA window, and select Git. This will open the Git Log tool window. Alternatively, you can use ⌘9 (macOS), or Alt+9 (Windows/Linux), to open the Git Log tool window.


1 Answers

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.

like image 182
Esko Luontola Avatar answered Oct 26 '22 01:10

Esko Luontola