【问题标题】:Check out file in multiple locations within the same repo similar to SVN externals在同一个仓库中的多个位置签出文件,类似于 SVN 外部
【发布时间】:2013-11-19 00:22:24
【问题描述】:

我已将 SVN 存储库移植到 GIT,但之前我有一个 svn:external 文件,但在 GIT 中无法识别。是否可以在 SVN 之类的外部文件中使用单一文件源,但签出到同一 repo 的其他目录中?

例如:

- test/img/hello.gif (original file)
- test2/img/hello.gif (references the first file)
- test3/img/hello.gif (references the first file)

我已经阅读了一些关于“sparse-checkout”的内容,但不确定您实际上如何仅引用/签出一个文件。

【问题讨论】:

标签: git git-submodules svn-externals git-subtree sparse-checkout


【解决方案1】:

由于您只有一个 repo,因此您无法使用“submodule following a branch”功能。

只剩下符号链接(我同意 Zach Lattacomment),尽管在 Windows 中使用它们很棘手:请参阅“Git Symlinks in Windows”。
符号链接并不完全等同于 SVN:external(因为它不能引用特定的修订,如 svn:external can),但在您的情况下它可能是一个足够好的解决方法。

【讨论】:

  • 谢谢,符号链接似乎是可行的方法,我会阅读更多内容,目前在不同环境中工作的开发人员存在问题,导致符号链接文件在 Windows 上不可读。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-05-03
  • 2012-02-27
  • 1970-01-01
  • 1970-01-01
  • 2023-01-13
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多