簡體   English   中英

git svn clone SVN倉庫單個目錄

[英]git svn clone of a single directory of SVN repository

我正在嘗試使用git svn將 SVN 存儲庫的單個目錄克隆到 Git 存儲庫中。

如果我使用git svn clone svn+ssh://path/to/repo/trunk/directory ,我會得到一個沒有分支的 Git 存儲庫,這些分支鏡像源 SVN 存儲庫中的分支。

如果我使用git svn --stdlayout svn+ssh://path/to/repo/trunk/directory ,我會得到一個空的 Git 存儲庫。 以下是命令的輸出:

Initialized empty Git repository in /directory/.git/
Using higher level of URL: svn+ssh://path/to/repo/trunk/directory => svn+ssh://path/to/repo
W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/trunk/directory'
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories

我讀過解決上述問題的方法是添加一個像-r 1000:HEAD這樣的修訂范圍,這仍然會產生一個空的 repo。 輸出是:

Initialized empty Git repository in /directory/.git/
Using higher level of URL: svn+ssh://path/to/repo/trunk/directory => svn+ssh://path/to/repo

關於如何使用 git-svn 克隆 SVN 存儲庫的子目錄的任何想法仍然從源 SVN 存儲庫中獲取所有分支和標簽?

你不想要標准布局,你想要這樣的東西:

git svn clone svn+ssh://path/to/repo/ --trunk=trunk/directory --branches=branches/*/directory --tags=tags/*/directory

准備並進入本地項目目錄:

mkdir local/project/path
cd local/project/path

使用 svn remote 初始化本地 git 存儲庫並獲取數據:

git svn init http://my_svn_server.com/repository/project/location
git svn fetch

歸功於 Gabriel Saldaña: http : //blog.gabrielsaldana.org/using-git-with-subversion-repository-subdirectory/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM