Pitfalls svn & # 8594; git migration

We are currently considering switching from svn to git for all the benefits that git offers. We are currently concerned about the loss of history and the study of this problem. We would like to know if anyone else had problems when they switched from svn to git.

+8
git svn
source share
5 answers

There should not be any problems converting from svn to git in regards to the loss of history. That the main purpose of version control software anyway is to keep track of history.

Of course, rule number one: always back up your repositories before converting them and perform several test runs until you feel confident enough to do this in a production environment.

The main difference is how Subversion's external actions behave compared to git submodules. Cm:

  • Why are git submodules incompatible with external svn?
  • How to adapt my svn: external strategy to git submodules?
  • Git tutorial submodule

We also expect to spend some time on user support. git is a different beast, and some familiar svn users may find it a little unintuitive to use.

Edit: git has built-in support for importing and working with svn repositories using git-svn .

+6
source share

Git-SVN import the entire Subversion history (and some additional metadata) into Git repo

git svn clone url://path/to/repo -s 

-s if you have a "standard" repo layout in Subversion

but some authors recommend using

 git svn init -s http://example.com/svn/my_proj git svn fetch 

Some additional useful data:

+4
source share

Most problems arise when SVN has non-standard branches or tags. This is when someone did not copy the trunk/ folder to tags/ or branches/ , but only subfolders. These folders look like "ripped" revisions without a common ancestor with the chest. But the content itself is correct.

+4
source share

I managed to transfer the svn history with the branch history to the git repository using the script I wrote here:

https://github.com/onepremise/SGMS

You can support both formats:

 /trunk /Project1 /Project2 /branches /Project1 /Project2 /tags /Project1 /Project2 

This scheme is also popular and supported by:

 /Project1 /trunk /branches /tags /Project2 /trunk /branches /tags 
+1
source share

Subversion and Git are very different from each other in the way they present history, save metadata, and handle specific system problems. Such differences cause most of the pitfalls:

  • Missing merging happens in Git:

    Subversion saves merge information as an svn: mergeinfo property in files and directories. When converting to Git, information about merging tree trees and cherry fences is lost because Git does not have the means to represent it.

    See also After "git svn clone" I still don't have a fantastic merge-merge merge?

  • External and submodules:

    Addition to @Sundae answer : look SmartGit - this tool can actually import svn: externals. It uses a file in a special format that is not supported by other Git clients.

  • Empty directories:

    Subversion treats directories as first-class citizens, Git does not - you need to add some placeholder file to save the directory during conversion. git-svn tries to handle this using the external "raw log" log, but this only works when you continue to use git-svn after the conversion.

  • svn: ignore and .gitignore, svn: eol-style / mime-type and .gitattributes:

    git-svn does not automatically convert Subversion properties to the corresponding .gitattributes. After the conversion, you need to add a specific command to add attributes - in any case, this information is lost during the conversion.

  • Arbitrary Subversion Properties:

    Any custom file and revision properties are lost when the Subversion repository is converted to a Git repository.

Check out SubGit . It handles most traps well; others are planned to be fixed in future versions.

SubGit is created as a migration tool for the entire company. It can be used as a one-shot conversion utility, but overall it is a Subversion and Git continuous synchronization tool. You can find more information on the page.

+1
source share

All Articles