add( script : obsidian_sync.bat )

This commit is contained in:
Marcin's_MI_Pro 2024-09-01 23:12:18 +08:00
parent f150bcc489
commit 2e8af56674

@ -0,0 +1,22 @@
@echo off
::配置Obsidian workspace地址
set obsidian_path="D:\note\Marcin_OB_Repo"
::切换目录到 Obsidian workspace下
cd %obsidian_path%
::先拉取远端更新
git pull
::判断是否有更新并将更新同步到远端仓库
for /f "delims=" %%a in ('git status --porcelain') do (
set HAS_CHANGES=1
goto end_loop
)
:end_loop
if defined HAS_CHANGES (
git add -A
git commit -m "Daily Sync"
git push origin main
) else (
echo Git has no changes.
)