push->changes[0]->new->name; // LOGIC if ($remoteref == $ref) { $commands = array( 'echo $PWD', 'whoami', 'git pull', 'git status', ); $log = "####### ".date('Y-m-d H:i:s'). " #######\n"; $log .= 'deploying ref: '.$ref; echo 'deploying ref: '.$ref; foreach($commands AS $command){ $tmp = shell_exec("$command 2>&1"); $log .= "\n\$ $command\n".trim($tmp)."\n"; } $log .= "\n"; file_put_contents($logfile,$log,FILE_APPEND); } else if(!isset($remoteref)) { die('no ref'); } else { die('wrong ref: '.$remoteref); } // OTHER HELPFUL COMMANDS /* 'git submodule sync', 'git submodule update', 'git submodule status', 'test -e /usr/share/update-notifier/notify-reboot-required && echo "system restart required"', */