1

我有以下设置,我正在处理一个project带有 submodule的项目submodule。每当我将更改推送到 github 时,它都会向服务器上的 update.php 发送一个发布请求。

这个 php 文件执行一个 git 命令。如果没有子模块,我可以做一个 git pull 并且一切都很好,但是使用子模块就困难得多。

我现在有这个,但它没有做我想要的。我应该 git pull repo 并更新并拉取每个子模块的最新版本。

<?php echo `git submodule foreach 'git checkout master; git pull; 
git submodule update --init --recursive; git commit -m "updating"' && git pull && 
git submodule foreach 'git add -A .' 
&& git commit -m "updating to latest version including submodules" 2>&1s`;

编辑// 好的,我完成了一半。

<?php echo `git submodule foreach 'git checkout master; git pull; 
git submodule update --init --recursive; git commit -am "updating"; echo "updated"' && 
git pull &&  git commit -am "updating to latest version including submodules" && 
echo 'updated'`;

echo 阻止脚本因为返回非零而停止。当我从控制台使用php update.php.

当 github 初始化文件时,或者我从浏览器运行它仍然无法工作。

有任何想法吗?

4

1 回答 1

2
于 2012-10-07T23:18:43.833 回答