Skip to content

Instantly share code, notes, and snippets.

View rubenmromero's full-sized avatar
☁️
Focusing

Ruben Martin rubenmromero

☁️
Focusing
View GitHub Profile
@rubenmromero
rubenmromero / pull_repos.sh
Last active February 19, 2018 23:24
Bash :: Pull changes from the origin (develop if it exists and master branches) to all Git repositories cloned in a workspace
#!/bin/bash
#
# Commands Definition
#
ECHO="echo -e"
TPUT_BOLD="tput bold"
TPUT_RED="tput setaf 1"
TPUT_OFF="tput sgr0"
@rubenmromero
rubenmromero / clean_deploy.php
Created August 27, 2018 13:08
PHP :: Web service to clean and deploy a repository to which it belongs on a server through a webhook
<?php
//Deploy the current version from master branch of the project
$document_root = "<repository_root_folder>";
echo "Clean untracked files on server:";
$output = shell_exec("git clean -d --force $document_root 2>&1");
echo "<pre>$output</pre>";
echo "Revert modified files (not staged) on server...";
$output = shell_exec("git checkout -- $document_root 2>&1");