Skip to content

Instantly share code, notes, and snippets.

@kougazhang
Created October 20, 2021 06:25
Show Gist options
  • Save kougazhang/14eaf4c65c8f136c735efb356457cd55 to your computer and use it in GitHub Desktop.
Save kougazhang/14eaf4c65c8f136c735efb356457cd55 to your computer and use it in GitHub Desktop.
#shell #git
#!/usr/bin/env bash
# sync src to git repository.
# src is file
src=$1
# dest is dir
dest=$2
cp $src $dest
pushd $dest
isDiff=`git status -s`
if [ -z $isDiff ]; then
echo "no changes, exit."
exit 0
fi
git add -A .
git commit -m "auto save"
git push origin master
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment