简体   繁体   English

SVN到git:迁移到git时,如何保存在SVN仓库中移动的文件的历史记录?

[英]SVN-to-git: How can I preserve history for files moved in SVN repo when migrating to git?

I have a situation similar to the following: 我遇到类似以下情况:

  • SVN Revision 1 SVN修订版1
    • FolderA/FileA.ext FolderA / FileA.ext

('svn move' used to move folder underneath a new folder) (“ svn move”用于将文件夹移动到新文件夹下)

  • SVN Revision 2 SVN修订版2
    • NewParent/FolderA/FileA.ext NewParent / FolderA / FileA.ext

Using SVN, I can verify the history is present for both revisions. 使用SVN,我可以验证两个修订版本都存在历史记录。

When I use 'git svn clone', the target folder contains both FolderA/FileA.ext and NewParent/FolderA/FileA.ext, and there is no history link between them. 当我使用'git svn clone'时,目标文件夹同时包含FolderA / FileA.ext和NewParent / FolderA / FileA.ext,它们之间没有历史链接。

How can I preserve the history link and only end up with the newer folder structure? 如何保留历史记录链接,而只能以较新的文件夹结构结束? I only need to migrate once (no link to SVN repo is needed). 我只需要迁移一次(无需链接到SVN存储库)。

First, check that the history is indeed lost, by checking this answer or here : 首先,通过检查此答案在此处检查历史记录是否确实丢失:

git log --follow -- NewParent/FolderA/FileA.ext
# or
git log -M --summary -- NewParent/FolderA/FileA.ext 

If the link seems lost, you can try convert your svn repo using subgit , which does more work to keep all the svn information identical in the new git repo (as its author explains here ). 如果链接似乎丢失了,您可以尝试使用subgit转换您的svn 仓库 ,这可以做更多的工作来使新的git 仓库中的所有svn信息保持一致(如作者在此说明 )。

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

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