同一文件夹中是否可以有多个本地 git 存储库?

发布于 2024-11-08 00:54:38 字数 773 浏览 0 评论 0原文

感谢您花时间阅读我的帖子。

我目前正在使用 Unity Engine - 它要求某些文件位于项目目录中的某些文件夹中。例如,假设我有一个假设的项目 - LameGame。我的文件夹看起来像这样,

./LameGame  
./LameGame/Assets  
./LameGame/Assets/Resources  
./LameGame/Assets/Editor  
./LameGame/Assets/Plugins  
./LameGame/Assets/Scripts

我通过 git 为 Unity Engine 维护了一些不同的插件,并且想知道是否有办法将它们作为子模块全部导入到同一个项目中。我遇到的问题是它们不能都有一个唯一的目录 - 它们需要像这样分布在目录之间:

PluginA

/Assets/Resources/PluginA/*
/Assets/Editor/PluginA/*
/Assets/Plugins/PluginA/*

PluginB

/Assets/Resources/PluginB/*
/Assets/Editor/PluginB/*
/Assets/Plugins/PluginB/*

所以理想情况下我正在寻找的是一个允许我的主项目以及所有插件都来自 Assets/ 文件夹。这可以用 Git 实现吗?

预先感谢您的任何意见/反馈/建议!

(注:我主要使用 Windows 7 和 TortoiseGit)

and thank you for taking the time to read my post.

I am currently working with Unity Engine - which requires certain files to be in certain folders within the project directory. For example, lets say I have this hypothetical project - LameGame. My folders would look like this

./LameGame  
./LameGame/Assets  
./LameGame/Assets/Resources  
./LameGame/Assets/Editor  
./LameGame/Assets/Plugins  
./LameGame/Assets/Scripts

I maintain a few different plugins for Unity Engine via git and was wondering if there was a way to import them all into the same project as submodules. The problem I'm running into is that they cannot all have a unique directory - they need to be spread between the directories like so:

PluginA

/Assets/Resources/PluginA/*
/Assets/Editor/PluginA/*
/Assets/Plugins/PluginA/*

PluginB

/Assets/Resources/PluginB/*
/Assets/Editor/PluginB/*
/Assets/Plugins/PluginB/*

So ideally what I'm looking for is a solution that allows my main project, as well as the plugins to all stem from the Assets/ folder. Is this possible with Git?

Thank you in advance for any input/feedback/suggestions!

(Note: I use Windows 7 primarily with TortoiseGit)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

旧人哭 2024-11-15 00:54:39

虽然非常不赞成,我的意思是非常,理论上你可以有一个 git 别名,它提供 --git-dir 参数来支持存储库之一的远程 .git 目录。然后,您可以将第一个存储库中的所有文件添加到第二个存储库的 .gitignore 中,反之亦然。然后,您可以“git commit”提交到第一个存储库,“altgit commit”提交到第二个存储库。

您最好像其他人建议的那样使用符号链接树,但从技术上讲它是可行的。

While very much deprecated, and I mean very, in theory you could have a git alias which provides the --git-dir argument to support a remote .git directory for one of the repositories. You could then add all of the files in first repo in the second's .gitignore and vis-versa. You could then "git commit" to commit into the first repository and "altgit commit" to commit into the second.

You are better off using a symlink tree as others have suggested, but it technically would work.

从来不烧饼 2024-11-15 00:54:39

我想你正在寻找这个:http://book.git-scm.com/5_submodules。 html

它准确地解释了如何在 Git 中设置子模块,并附有示例

I think you're looking for this: http://book.git-scm.com/5_submodules.html

It explains exactly how to set up submodules in Git, complete with examples

躲猫猫 2024-11-15 00:54:38

我宁愿:

I would rather:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文