How do I check whether the remote repository has changed and I need to pull?
Now I use this simple script:
git pull --dry-run | grep -q -v \'Already
Using simple regexp:
str=$(git status) if [[ $str =~ .*Your\ branch\ is\ behind.*by.*commits,\ and\ can\ be\ fast-forwarded ]]; then echo `date "+%Y-%m-%d %H:%M:%S"` "Needs pull" else echo "Code is up to date" fi