#!/bin/bash # Path to the current directory (where the script is being executed) VAULT_PATH=$(pwd) COMMIT_MESSAGE="Update notes - $(date '+%Y-%m-%d %H:%M:%S')" # Navigate to the vault directory cd "$VAULT_PATH" || { echo "Error: Vault directory not found." exit 1 } # Check if it's a Git repository if [ ! -d ".git" ]; then echo "Error: This directory is not a Git repository." exit 1 fi # Stage all changes git add . # Check if there is anything to commit if git diff --staged --quiet; then echo "No changes to push." exit 0 fi # Commit the changes git commit -m "$COMMIT_MESSAGE" # Push to the remote repository git push origin main # Success message echo "Obsidian notes successfully pushed!"