Last active
August 9, 2018 20:08
-
-
Save K-Ko/bd91fa6980819e749069f6714714a318 to your computer and use it in GitHub Desktop.
Automatic push daily work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# sudo wget -O /usr/local/bin/git.nigthly https://gist.githubusercontent.com/K-Ko/bd91fa6980819e749069f6714714a318/raw/git.nigthly | |
# sudo chmod 755 /usr/local/bin/git.nigthly | |
# | |
# set -x | |
[ -z "$1" ] && printf "\nUsage: $0 <repo directory> [<repo directory> ...]\n" && exit 1 | |
while [ "$1" ]; do | |
dir=$(readlink -f $1) | |
if [ -d "$dir" -a -d "$dir/.git" ]; then | |
echo "::: $dir ..." | |
export GIT_WORK_TREE=$dir | |
export GIT_DIR=$dir/.git/ | |
git add -A | |
git commit -m "$(date +%Y-%m-%d) nightly" | |
git push --set-upstream origin master | |
else | |
echo "::: INVALID $dir" >&2 | |
fi | |
shift | |
done | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment