Skip to content

Instantly share code, notes, and snippets.

@cowlike
Created February 12, 2023 17:34
Show Gist options
  • Save cowlike/0140ed3fcb6dbe78152e585f36e2bc3c to your computer and use it in GitHub Desktop.
Save cowlike/0140ed3fcb6dbe78152e585f36e2bc3c to your computer and use it in GitHub Desktop.
obsidian sync
#!/usr/bin/env sh
OB_PATH="~/Documents/obsidian"
cd "$OB_PATH"
echo "$(date): updating folder: $(pwd)"
git pull
CHANGES_EXIST="$(git status — porcelain | wc -l)"
if [ "$CHANGES_EXIST" -eq 0 ]; then
exit 0
fi
git add .
git commit -q -m "$(date +"%Y-%m-%d %H:%M:%S")"
git push -q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment