2016-08-04 137 views
3

在Windows 10上從svn(服務器版本1.6.11)遷移到git(版本2.9.2)似乎不像描述的那樣工作(我想保留所有svn-標籤和分支)。在windows上從svn遷移到git 2.9.2

首先嚐試:

我也跟着在https://www.atlassian.com/git/tutorials/migrating-convert提供的教程。

結果:所有分支都將被刪除,當執行以下命令:

java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git 
--force 

接着嘗試:

我隨後在https://git-scm.com/book/it/v2/Git-and-Other-Systems-Migrating-to-Git描述的步驟:

  • 結帳該項目:git svn clone --stdlayout --authors-file=authors.txt --no-metadata http://<the-svn-url-without-trunk> <module-directory>

  • 檢出命令git tag -l產生空輸出。

  • git branch -a產生以下輸出(如預期):

    *master remotes/origin/tags/de-vgwort-jerry-configuration-1.0.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.0.1 remotes/origin/tags/de-vgwort-jerry-configuration-1.0.2 remotes/origin/tags/de-vgwort-jerry-configuration-1.1.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.2.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.3.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.4.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.4.1 remotes/origin/tags/de-vgwort-jerry-configuration-1.5.0 remotes/origin/trunk

根據文檔的下一步驟:

To move the tags to be proper Git tags, run 

$ cp -Rf .git/refs/remotes/origin/tags/* .git/refs/tags/ 
$ rm -Rf .git/refs/remotes/origin/tags 

問題:

的路徑.git/refs/remotes/origin/tags/是空的。所有SVN標籤似乎位於

.git/svn/refs/remotes/origin/tags 

目錄.git/svn/refs/remotes/origin/tags包含每個標籤的子目錄。我想這些目錄移動到.git/refs/tags/但在執行時git branch -a這導致下面的輸出,:

warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.0.0/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.0.0/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.0.1/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.0.1/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.0.2/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.0.2/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.1.0/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.1.0/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.2.0/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.2.0/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.3.0/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.3.0/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.4.0/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.4.0/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.4.1/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.4.1/unhandled.log warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.5.0/index warning: ignoring broken ref refs/tags/de-vgwort-jerry-configuration-1.5.0/unhandled.log * master remotes/origin/tags/de-vgwort-jerry-configuration-1.0.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.0.1 remotes/origin/tags/de-vgwort-jerry-configuration-1.0.2 remotes/origin/tags/de-vgwort-jerry-configuration-1.1.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.2.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.3.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.4.0 remotes/origin/tags/de-vgwort-jerry-configuration-1.4.1 remotes/origin/tags/de-vgwort-jerry-configuration-1.5.0 remotes/origin/trunk

接下來試着從https://github.com/nirvdrum/svn2git

使用svn2git。但是這個工具似乎也不起作用。運行

svn2git <svn-url-without-trunk> --authors ..\authors.txt 

該命令後git branch -a產生以下輸出:

* master remotes/svn/trunk

=>這個結果是完全無用。

我在這裏錯過了什麼?是否有適用於Windows和最新的git版本2.9.2的文檔?

回答

1

對於單向導入,可以嘗試subgit import

SubGit具有進口提供免費優惠,而且通常比git svn更加完整。

+0

謝謝,我會試試看。 –

+0

子文件導入工作正常(並且比git svn快得多)。 感謝您的幫助。 –