Skip to content

Instantly share code, notes, and snippets.

@fadlee
Last active June 30, 2020 10:17
Show Gist options
  • Save fadlee/3e01c68e495bed6c2f8b2e85f7198c5b to your computer and use it in GitHub Desktop.
Save fadlee/3e01c68e495bed6c2f8b2e85f7198c5b to your computer and use it in GitHub Desktop.
Git as a time machine for file backup
#!/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
@fadlee
Copy link
Author

fadlee commented Jun 30, 2020

Just include files & folders in mu-plugins

.gitignore

# First, ignore everything
*

# Whitelist .gitignore
!/.gitignore

# Whitelist anything that's a directory, this is required
!*/

# ...except the ones we want
!.vscode/**/*.*
!wp-content/mu-plugins/**/*.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment