Created
April 19, 2025 15:32
-
-
Save guiofsaints/e6993d6ebc9df01f18d98c2bc19512b1 to your computer and use it in GitHub Desktop.
Sync Obisdian
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment