vault: sync pending changes

This commit is contained in:
Yaojia Wang
2026-03-25 23:37:37 +01:00
parent 01e93719fb
commit 91884751e8
3 changed files with 482 additions and 0 deletions

23
scripts/auto-sync.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
# Auto-sync Obsidian vault to git remote
# Runs daily via Windows Task Scheduler
VAULT_DIR="/c/Users/yaoji/git/Knowledge"
cd "$VAULT_DIR" || exit 1
# Check if there are any changes
if git diff --quiet && git diff --cached --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
echo "$(date): No changes to sync"
exit 0
fi
# Stage all changes
git add -A
# Commit with timestamp
git commit -m "vault: auto-sync $(date '+%Y-%m-%d %H:%M')"
# Push to remote
git push origin main
echo "$(date): Sync complete"