Incremental Migration from SVN to Git
Asked Answered
B

1

1

Consider my below scenario :

Suppose my svn repository contains 100 revisions, which has been migrated to Git Repository (So my Git contains the 100 revisions).

Now my svn repository got updated, say with 5 more revisions hence it has 105 revisions. How do i migrate only the revisions 101 t0 105 to my GIT repository?

The main challenges I have :

  1. I dont want to sync both SVN and Git.(SVN will be decommisioned soon)
  2. I need to migrate the Revisions with its history.

I tried following up with these links which dont help me,(fyi)

  1. Using svnsync

  2. USing git svn clone

Blackandwhite answered 20/3, 2015 at 7:39 Comment(7)
Whats wrong with the anders in #747575 ? They don't work? or?Leeuwarden
I wish to migrate to the existing Git repository and i should bring History for me.Blackandwhite
That part was pretty clear, but why dont the linked questions help you? especially the 2ndLeeuwarden
It is not bringing revisions from 101 to 105, as i mentioned I need only the latest revisions to get it updated to the migrated Git repository.Blackandwhite
You can specify the revisiions you want to cloneLeeuwarden
I had specified the revision number.Blackandwhite
That may be because 101 to 105 occurred somewhere other than trunk. You need to make sure you tell git-svn how you wanted Subversion mapped into Git. There's a --stdlayout option, but if that doesn't work for you, then you should specify it manually. Not all commits will appears as history for the master branch--some commits may have just been for tags, or for other branches. Those commits will appear in their respective places within the Git repo when you have them mapped correctly.Servomotor
R
4

Use git-svn. When you do initial clone git svn clone ... you will get the first 100 revisions. Later you do git svn fetch which would fetch the newly appeared 5 revisions.

All 105 revisions will be present in a correct order thus the history will be preserved.

Update:

If you wish to avoid getting first 100 revisions, do git svn init with fetch initially:

git svn init ...
git svn fetch -r <svn revision you want to start from>
Revealment answered 22/3, 2015 at 11:36 Comment(10)
Mykola it wont bring HISTORY.Blackandwhite
Saby, it WILL bring HISTORY :)Revealment
How you are saying by doing git svn clone it ll bring only the first 100 revisions? @Mykola When I did git svn clone brought 105 revisions.Blackandwhite
Saby, if you want to skip the earlier revisions and keep only the last 5 revisions, you may use -r/--revision option together with the initial git svn fetch.Revealment
Yeah I understood. But now I am talking about the first step which you had mentioned about git svn clone.Blackandwhite
Yes I did git svn fetch, how can I push it now to the Git repository.Blackandwhite
after successful git svn fetch you should get svn revisions fetched to your git-svn repository.Revealment
Thanks Mykola, Its working fine. But I am unable to push it to server.Blackandwhite
You may describe your next problem in a new questionRevealment
Hi All, I have exactly the same problem. But when I do git svn fetch only the remote ref is getting updated not the local branch I have created for each refGranger

© 2022 - 2024 — McMap. All rights reserved.