简体   繁体   English

如何使用git svn克隆svn repo并能够同时提交给git和svn?

[英]How to clone svn repo with git svn and be able to commit to both git and svn?

I have the following scenario: 我有以下情况:

I am porting a big repo from which some catalogs I would like to separate into git repositories with independent/separate history, eg: 我正在移植一个大型仓库,我想从中将一些目录分离为具有独立/独立历史记录的git存储库,例如:

git svn clone  --trunk=https://svne1.XXX.XXX.com/XXXX/svnroot/trunk/ https://svne1.XXX.XXX.com/XXXX/svnroot/trunk/src/project1 --username myname --no-metadata -A ~/Documents/users.txt

This will create a git repository with extracted source code from src/project1 under the trunk and with separate history and I will be able to push it anywhere I desire. 这将创建一个git存储库,并从src/project1的主干下提取源代码并具有单独的历史记录,并且我可以将其推送到所需的任何位置。

But I need (for some time) to be able to push to svn repo as well and taking into account that I have downloaded only the history of one directory from my project and not the trunk it is not so trivial to allow: 但是我(需要一段时间)也能够推送到svn repo,并考虑到我仅从我的项目中下载了一个目录的历史记录,而不是从trunk下载的,因此它并不简单:

git svn rebase
git svn dcommit

How can I do this then? 那我该怎么做呢? Having extracted multiple repos from svn to git and commit to both git and svn (having in mind that history in those smaller git repos are different (subset) of history in svn) 从svn提取了多个存储库到git并同时提交给git和svn(请记住,较小的git存储库中的历史记录与svn中的历史记录不同(子集))

EDIT : 编辑

After launching running the clone operation and then git svn rebase I would get: 启动运行克隆操作,然后git svn rebase我将得到:

git svn rebase
Unable to determine upstream SVN information from working tree history

You should not use --no-metadata if plan staying in sync: 如果计划保持同步,则不应使用--no-metadata

svn.noMetadata, svn-remote..noMetadata svn.noMetadata,svn-remote..noMetadata

  This gets rid of the git-svn-id: lines at the end of every commit. This option can only be used for one-shot imports as git svn will not be able to fetch again without metadata. 

I don't think you also need to specify --trunk unless you want to use branches, and if so - would expect trunk to be below the main url, not above. 我不认为您也不需要指定--trunk除非您想使用分支,如果是这样-会期望trunk在主url之下,而不是在上面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM