vault: sync pending changes
This commit is contained in:
23
scripts/auto-sync.sh
Normal file
23
scripts/auto-sync.sh
Normal 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"
|
||||
Reference in New Issue
Block a user