Skip to content

Instantly share code, notes, and snippets.

@yigitozgumus
Created January 31, 2021 12:39
Show Gist options
  • Save yigitozgumus/6666ac009b9636bd0a08759667a9b119 to your computer and use it in GitHub Desktop.
Save yigitozgumus/6666ac009b9636bd0a08759667a9b119 to your computer and use it in GitHub Desktop.
This script updates the repo if any change is performed
#!/bin/sh
CHANGES_EXIST="$(git status --porcelain | wc -l)"
if [ "$CHANGES_EXIST" -eq 0 ]; then
exit 0
fi
git stash
git pull
git stash pop
git add .
git commit -q -m "Last Sync: $(date "+%d-%m-%Y %H:%M:%S")"
git push -q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment