简体   繁体   English

从SVN迁移到GIT时的外部

[英]Externals when migrating from SVN to GIT

Ok, I've read it all, and tried to find solutions to my problem to no avail, so was wondering if anyone would be able to give me the ultimate solution to the migration issue I'm having. 好的,我已经阅读了所有内容,并试图找到我的问题的解决方案无济于事,所以想知道是否有人能够给我最终解决我遇到的迁移问题。

It's to do with using SVN externals in GIT, so hold on to your chairs. 这与在GIT中使用SVN外部有关,所以请坚持你的椅子。

I have looked at the following topics only to find that no one has the exact same setup as I have. 我查看了以下主题,但发现没有人拥有与我相同的设置。

Now my setup is really not that complicated, but I can't work out a way to get it working the way I need it. 现在我的设置真的不那么复杂,但我无法找到一种方法让它以我需要的方式工作。 I have: 我有:

  • Project1 PROJECT1
    • Core 核心
    • Libs 利布斯

I then have in my main project 然后我进入我的主项目

  • MainProject MainProject
    • MainFolder MainFolder
      • file.cs file.cs
      • file1.cs file1.cs
      • file2.cs file2.cs
      • Core (external of Project1) 核心(Project1的外部)
    • Libs (external of Project1) Libs(Project1的外部)

Obviously this is fine on SVN, as you can use externals, but with sub-modules, you can only create them pointing to the root of the repository, which in this case doesn't quite work for me, since I have both Core and Libs on the same repository. 显然这在SVN上很好,因为你可以使用外部,但是对于子模块,你只能创建它们指向存储库的根目录,在这种情况下对我来说不太适用,因为我同时拥有Core和Libs在同一个存储库中。 Moving them out isn't an option at this point, since we're still in the migration process, and I need to keep constantly syncing them. 此时移出它们不是一种选择,因为我们仍处于迁移过程中,我需要不断地同步它们。

I then thought I could just go and use symlinks (notice I'm on a windows environment), as this way I would be able to checkout my Project1 repository at the same level as my MainProject, and via symlinks make sure my project still thinks everything is where it should. 然后我想我可以去使用符号链接(注意我在Windows环境中),这样我就可以在与我的MainProject相同的级别检查我的Project1存储库,并通过符号链接确保我的项目仍然认为一切都应该在哪里。

This magically worked, however, upon doing git status I now noticed Project1 was marked as Untracked files , and by committing this and pushing, and checking out again, my symlink was gone, and I now had a hard copy of my Project1 repository copied into MainProject. 然而,在做git status我现在注意到Project1被标记为Untracked files ,并且通过提交和推送,再次检出,我的符号链接已经消失了,我现在将我的Project1存储库的硬拷贝复制到MainProject。

This obviously turned out to be a bit of a nightmare ow, so I was just wondering if anyone could help me with this, and maybe point me towards the right direction. 这显然是一个噩梦,所以我只是想知道是否有人可以帮我这个,也许我指向正确的方向。

Thanks in advance, 提前致谢,

Marcos 马科斯

While I believe Michael Geddes is working on supporting symlinks in a future msysgit2, there is one way to get that support right now (that you have mentioned) 虽然我相信Michael Geddes正在努力在未来的msysgit2中支持符号链接,但现在有一种方法可以获得支持(你已经提到了)
" Git Symlinks in Windows " Windows中的Git Symlinks

It allows to restore symlinks on checkout in Windows. 它允许在Windows中结帐时恢复符号链接。

If you add Project1 as a submodule of your main project: 如果将Project1添加为主项目的子模块:

  • it won't be displayed as untracked files in your git status . 它不会在您的git status显示为untracked files
  • you can add a symlink in MainFolder to (Project1/)Core in order to get the structure you want. 你可以在MainFolder添加一个符号链接到(Project1/)Core ,以获得你想要的结构。

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

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