Thursday 4 August 2016

Textual description of firstImageUrl

How to migrate from SVN to GIT repository

This post describes step by step guide to migrate your svn repository to git repository.
First , lets have a look as why git is better than svn .

1) GIT is distributed, SVN is not.
 2) GIT stores content as metadata, SVN stores just files.
3) GIT branches are not the same as SVN branches.
4) GIT does not have a global revision no. like SVN do.
5) GIT’s content integrity is better than SVN.

Now we see the different structures of both these .
SVN :


->Trunk
->Branches
->Tags
->Extra DIR


GIT:


->Single Working Directory
.git directory stores binary format of branches , tags and other details.

Steps:

1. Download Subgit from above link
2. Make Sure you have java version >= 1.7
3. Note Down the SVN URL & Git Remotes
4. Extract the Downloaded archive.
5. Execute the below Commands
6. ~/Softwares/subgit-3.2.0/bin/subgit configure --layout auto https://svn.xysys.net/svn/dynamic-feed-server/projects/dsc dsc.git
7. The above command will detect the latest revision , history , branches, tags and configure authors.
8.  Once Done execute
9.  ~/Softwares/subgit-3.2.0/bin/subgit install dsc.git/  This would take some time depending on the revisions and the no of time file got modified to convert revision to git commits. Have Patience.
10. git clone dsc.git
11. This Would create your dsc git project with all tags , branches etc…
12. cd dsc && git branch –ar would list all the branches. You can also use git log to see the revisions converted to GIT Commits.
13. IMP:  git remote –v would saw you locat path which need to be changed to GIT Remote.
14. In mycase : In file .git/config , url = /Users/mohantysan/workspace/GitMigration/dsc.git 
We need to Change it to Git URL else if you make any commits and push it will push to SVN REPO.
Change the url to something like this :
url = git@github.com/ae/dsc.git
Now Your SVN Repo is Converted and ready to be published.
 git push origin –all # will push your code with all svn converted revision to GIT and you can use it as usual.
For Publishing Branches and Tags checkout branches and tags locally and push 
Happy Migration , Thank You

This post is created by Santosh Mohanty . You can contact him for any questions at santa.jyp@gmail.com or message him on his linkedIn profile .