-2

I am new to git and in the process of migrating from SVN to github. I have been using Visual SVN Server+TortoiseSVN on Windows for years.

I found a few guides like this How do I migrate an SVN repository with history to a new Git repository? and https://alastaircrabtree.com/converting-an-svn-repository-to-git-on-windows/

However, I have problems with the push command only submitting some of the SVN revisions and not all. In "MyProject", the latest revision is 654 but git only push'es until rev. 633 and does not include all previous revisions (i.e. there are gaps in revisions).

SVN log:

svn log

Repo browser:

repo browser tortoise svn

Here is what I do in git bash (https://git-scm.com/):

I have a main folder created to contain all source code, i.e. c:\web\git. I run the following commands:

$ git svn clone "https://<myip>/svn/myproject/" "C:\Web\git\myproject" 
  --stdlayout --authors-file="c:\web\authors.txt"

Log says:

  Initialized empty Git repository in C:/Web/git/myproject/.git/ 
  Found possible branch point: https://<myip>/svn/myproject/myproject => 
  https://<myip>/svn/myproject/branches/newdash, 630 
  Initializing parent: refs/remotes/origin/newdash@630
          A        somefile.txt
          A        somefile2.txt
  r1 = d6d733625726656a8e4f6a4fcc3394ee6dc6b5c9 (refs/remotes/origin/newdash@630)
  ...
  r629 = 020c46bbcd50ecefd57ed9f49cd0d2def8444af3 (refs/remotes/origin/newdash@630)
    Found branch parent: (refs/remotes/origin/newdash) 
    020c46bbcd50ecefd57ed9f49cd0d2def8444af3
    Following parent with do_switch
    Successfully followed parent
  r631 = 9564fcb7966649428ec7775cf6ccf4d66e1305c4 (refs/remotes/origin/newdash)
           M       Properties/launchSettings.json
           M       web.config
  r633 = 4ebce676525bfeb8f1d8d680c706b7d9c4e872c3 (refs/remotes/origin/newdash)
    branch_from: /branches => /branches/newdash
    Found possible branch point: https://<myip>/svn/myproject/branches/newdash =>
    https://<myip>/svn/myproject/branches/newdash, 652
    Found branch parent: (refs/remotes/origin/newdash) 
    4ebce676525bfeb8f1d8d680c706b7d9c4e872c3
    Following parent with do_switch
    Successfully followed parent

  r654 = 336c75066b52c5d0a45e5e14e891a132d6e361e6 (refs/remotes/origin/newdash)
   fatal: refs/remotes/origin/trunk: not a valid SHA1
   update-ref HEAD refs/remotes/origin/trunk: command returned error: 128

As can be seen from above log, there is a jump from r633 -> r653. In addition, there are other gaps in the clone process e.g. r498 -> 505 is also missing as well as others:

            M       Startup.cs
            M       myproject.csproj
            M       web.config
   r497 = aba855a1c283a263d563ccec486c1042e6757cfb (refs/remotes/origin/newdash@630)
            M       Views/Shared/_Layout.cshtml
   r506 = b8f107ab597eb74549fa75e02cd980b367c61684 (refs/remotes/origin/newdash@630)

Anyways, I continue just to see what happens so I do:

$ cd myproject

User@MyPC MINGW64 /c/Web/git/MyProject (master)
$ git branch -a
  remotes/origin/newdash
  remotes/origin/newdash@630

Then

User@MyPC MINGW64 /c/Web/git/MyProject (master)
$ git for-each-ref refs/remotes | cut -d / -f 3- | grep -v @ | while read branchname;
  do git branch "$branchname" "refs/remotes/$branchname"; git branch -r -d
  "$branchname"; done

User@MyPC MINGW64 /c/Web/git/MyProject (master)
$ git branch -a
  origin/newdash
  remotes/origin/newdash@630

And then finally pushing it to github (after I have created the repo at github.com).

User@MyPC MINGW64 /c/Web/git/MyProject (master)
$ git remote add origin https://github.com/myuser/myproject.git
$ git branch -M master
$ git push -u origin master

The repo is pushed to github but as mentioned earlier not all the revisions are included. I figure this has something to do with branches but I am not sure how to fix this so that everything is uploaded to github (all revisions).

Hoping someone knows what is going on and how to fix it.

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
Sha
  • 2,185
  • 1
  • 36
  • 61

1 Answers1

1

I am not sure how to fix this

  1. Read docs carefully
  2. Understand written text

git svn can track a standard Subversion repository, following the common "trunk/branches/tags" layout, with the --stdlayout option.

and its applicability to your situation (NO)

  1. Use proper options to describe real layout of your repo (which I can't see at all on screenshot)
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • 1
    Thanks for your inputs. As mentioned, I am new to git so please no need for the harsh tone. – Sha Jan 11 '22 at 08:16