git - 将 GIT 用于在多个位置具有目录的项目

标签 git codeigniter frameworks

我正在尝试将 PHP/MySQL 网络应用程序(基于 CodeIgniter 2.01 框架构建)移动到 GIT 存储库。问题是为了增加安全性,我已经实现了分离应用程序部分(应用程序和系统文件夹)和 Web 文件(index.php、图像、css、js 等文件夹)的最佳实践。 Web 文件位于/var/www,应用程序位于/data/company/apps/myapp。

由于我想保留这种额外的安全性,我该如何将具有多个位置的项目迁移到 GIT 中?

最佳答案

我认为您的 Git 存储库的结构和已部署 文件的结构不需要匹配:

  • 要么添加一个额外的步骤(例如 post-receive Hook )将文件从 Git 存储库复制到正确的系统路径(将 SCM -- 源代码控制管理 -- 从 RM 中分离出来 - - 发布管理),
  • 或者您将两个系统路径直接链接到 Git 存储库中的两个相关目录。

我在评论中补充说:

if you reorganize your repo's content in order to have to directories with the relevant content, you can make two git archive for each directory, and extract them in the right places.

OP crashintoty回复:

I found the solution with the following commands in post-update:

git archive --format=tar master:guts/  | \
  tar -C /data/company/apps/myapp -x 
git archive --format=tar master:skin/ | tar -C /var/www -x

关于git - 将 GIT 用于在多个位置具有目录的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5590995/

相关文章:

git - 如何使用 Git 建立存储库层次结构?

git - 将 CVS 存储库导入 GIT 会导致一些与时间戳相关的误导行为

javascript - CodeIgniter 没有破坏我的 session

ios - TWTweetComposeViewController 中的错误?

Javascript 框架来跟踪详细的用户行为?

git - 我可以从这个 git 错误中恢复吗? "fatal: Duplicated ref, and SHA1s don' t 匹配 : refs/heads/BranchName"

git - maven 发布插件、git 和 pom 不在顶部

mysql - 如何用数据表解决Codeigniter中的搜索问题

mysql - 多点赞查询

php - Yii 如何高亮显示当前菜单项