在执行环境中拥有 Git 存储库是一种好习惯吗?

Is a good practice to have the Git repository on the execution environment?

即使是开发环境?

我有一个带有 Moodle 实例的开发服务器。目前,我有以下结构:

/var/www/html/moodle/<-- 我的 Moodle 实例 运行 在我的开发服务器上。

/var/git/ <-- 我的 moodle.git 存储库与我开发的插件的 git 存储库相同。为此,我使用构建工具等将源代码移动到 Web 服务器中的 Moodle 目录,以加快速度。

另一种选择是这样的:

Moodle (execution environment)
├── .git
└── local
    ├── plugin_a
    │   ├── .git
    │   └── source.php
    └── plugin_b
        ├── .git
        └── source.php

每个插件都有自己的存储库,就像 Moodle 一样。

哪一个是最佳实践,考虑到这不是生产环境,只是开发环境?

Which would be the best practice?

第一个:您在开发环境(.git 存储库)和部署环境(/var/www/html/moodle/)之间保持明确的分离

当出现问题时,您不希望必须通过 git 数据 文件 运行 您的应用程序。