Tuesday, 26 December 2017

TechTip - SVN to GIT Migration - Renaming/Refactoring Projects

During SVN to GIT Migration, I have faced one challenge that is renaming/restructuring projects while migration.

Let say, you have following maven project in SVN

old-project
-- src
-- pom.xml

Now you want this project to be renamed while migrating to GIT and it should look like below:

new-project
-- src
-- pom.xml

If you try changing this name while cloning projects from SVN to GIT just like below. You will loose history after migration. But you must think about solution where history remain as it is but your project can be renamed or restructured.

git svn clone --trunk=/trunk --branches=/branches --branches=/bugfixes --tags=/tags --prefix=origin/ --authors-file= svn-committer.txt  svn://xyz.com/SRC/Trunk/old-project new-project

How to do it? 

Actually, there is no rocket science I have applied here. Its pretty simple. You just need to refactor/rename your projects in SVN itself. The good part is, SVN still maintains full history even after renaming the folder names while copying from one place to another. This is really one of the great features in SVN that I will miss in GIT for sure.

First copy your project in SVN itself with required name using below command

svn copy <source-svn-url>   <destination-svn-url> -m "Renamed project name"


Example:

svn copy svn://xyz.com/SRC/Trunk/old-project  svn://xyz.com/SRC/GIT-SRC/new-project -m "Renamed project name from old-project to new-project"

Do whatever refactoring you want to do with your project in SVN itself. Now once you are ready with structure of your  project which must be there in GIT as repository, you can use your refactored location to clone project.

git svn clone --trunk=/trunk --branches=/branches --branches=/bugfixes --tags=/tags --prefix=origin/ --authors-file= svn-committer.txt  svn://xyz.com/SRC/GIT-SRC/new-project new-project

After migration in GIT, you can see full change history of old-project including message 'Renamed project name from old-project to new-project' that you just did while renaming the project in SVN itself from old to new location.

Renaming/Refactoring was a big challenge but with this simple approach I could successfully renamed/refactored projects while SVN to GIT migration.

If you are looking for post about how to migrate from SVN to GIT. You can refer my another post.


4 comments:

  1. SHREE SAI PACKERS AND MOVERS
    #18/3, 30ft road,, sri krishna colony,
    kuduregere main road,, alur post,
    Bangalore, Karnataka 562123
    080736 70915
    Packers and movers bangalore

    Guru TV Repair
    52 shampura main road, Munni veerappa layout
    Kaval bairasandra
    Bengaluru, Karnataka 560032
    080888 33910
    Led tv repair in bangalore

    Graphica Gauges and Tools
    S. No. 37, Ramnagar, Ramnagar Tempo Chowk,Vadgoensheri
    Pune, Maharashtra 411014
    098508 84992
    Thread Ring Gauges

    iRobo Wellness Private Limited
    AryaHub Mall No. 22
    Hope farm Junction Whitefield
    Bangalore, Karnataka 560066
    099806 58125
    Massage chair

    ReplyDelete
  2. Social media will probably be performance thus successfully. social media is an effective portion of search engine ranking. the concept offers you an excellent impact for your requirements venture.cannabis business Canada

    ReplyDelete