add( script : obsidian_sync.bat )
This commit is contained in:
parent
f150bcc489
commit
2e8af56674
22
05.auto_work/obisidian_sync.bat
Normal file
22
05.auto_work/obisidian_sync.bat
Normal file
@ -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.
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue
Block a user