shell脚本中判断git repo中是否存在变更

工作需要,shell脚本中实现自动push 更新,如果有更新,执行git  add,git commit,git push 等操作,没有则不操作。

cd ${repo_path}
if [ -n "$(git status -s)" ];then
    git add .
    git commit -m "update file"
    git push origin master
fi

 

你可能感兴趣的:(linux,and,shell,git)