Skip to content

Instantly share code, notes, and snippets.

@rohozhnikoff
Created October 28, 2014 00:20
Show Gist options
  • Save rohozhnikoff/0f3f678d585e7f302948 to your computer and use it in GitHub Desktop.
Save rohozhnikoff/0f3f678d585e7f302948 to your computer and use it in GitHub Desktop.
simple half-auto backup to git on php (just for concept)
<%
$default_branch = 'master';
$message = 'auto-commit';
if (isset($_GET['message']) && $_GET['message'] != '') {
$message = $_GET['message'];
}
$message .= 'from ' . date("Y-m-d H:i:s")
$results = array();
$results[] = shell_exec('git add .');
$results[] = shell_exec('git commit -am ' . $message);
$results[] = shell_exec('git push origin ' . default_branch);
echo '<pre>' . json_encode($results) . '</pre>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment