从 svn 迁移到 git 不包括所有修订

Migrating from svn to git does not include all revisions

我是 git 的新手,正在从 SVN 迁移到 github。我多年来一直在 Windows 上使用 Visual SVN Server+TortoiseSVN。

我找到了一些这样的指南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/

但是,我对 push 命令有问题,只提交了部分 SVN 修订版,而不是全部。在 "MyProject" 中,最新版本是 654,但 git 只有 push'es 直到版本。 633 并且不包括所有以前的修订(即修订中存在差距)。

SVN日志:

回购浏览器:

这是我在 git bash (https://git-scm.com/) 中所做的:

我创建了一个包含所有源代码的主文件夹,即 c:\web\git。 我运行以下命令:

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

日志说:

  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

从上面的日志可以看出,从r633 -> r653开始跳转了。此外,克隆过程中还有其他差距,例如r498 -> 505 也和其他人一样失踪:

            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)

无论如何,我继续看看会发生什么,所以我这样做:

$ cd myproject

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

然后

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

然后最终将它推送到 github(在我在 github.com 上创建了 repo 之后)。

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

repo 被推送到 github,但如前所述,并非所有修订都包含在内。我认为这与分支有关,但我不确定如何解决此问题以便将所有内容上传到 github(所有修订版)。

希望有人知道发生了什么以及如何解决它。

I am not sure how to fix this

  1. 仔细阅读docs
  2. 理解书面文字

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

及其对您情况的适用性(否)

  1. 使用适当的选项来描述你的 repo 的真实布局(我在屏幕截图上根本看不到)