21 lines
498 B
Batchfile
21 lines
498 B
Batchfile
|
|
@echo off
|
||
|
|
::配置Obsidian workspace地址
|
||
|
|
set obsidian_path="D:\Files\3.SelfLerning\Marcin's_Repo"
|
||
|
|
::切换目录到 Obsidian workspace下
|
||
|
|
D:
|
||
|
|
cd %obsidian_path%
|
||
|
|
|
||
|
|
::判断是否有更新并将更新同步到远端仓库
|
||
|
|
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 from workbook"
|
||
|
|
git push origin main
|
||
|
|
) else (
|
||
|
|
echo Git has no changes.
|
||
|
|
)
|