Last active
June 30, 2020 10:17
-
-
Save fadlee/3e01c68e495bed6c2f8b2e85f7198c5b to your computer and use it in GitHub Desktop.
Git as a time machine for file backup
This file contains hidden or 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 | |
gitstatus=`git status -s -uall` | |
curtime=`date` | |
# Check if has changes | |
if echo $gitstatus | grep "."; then | |
git add . | |
git commit -m "Automatic Backup @ $curtime | |
Changes: | |
$gitstatus" | |
# git push origin master | |
else | |
echo "No changes @ $curtime" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just include files & folders in mu-plugins
.gitignore