diff --git a/05.auto_work/obsidian_pull.bat b/05.auto_work/obsidian_pull.bat new file mode 100644 index 0000000..7e8c6fc --- /dev/null +++ b/05.auto_work/obsidian_pull.bat @@ -0,0 +1,9 @@ +@echo off +::配置Obsidian workspace地址 +set obsidian_path="D:\Files\3.SelfLerning\Marcin's_Repo" +::切换目录到 Obsidian workspace下 +D: +cd %obsidian_path% + +::先拉取远端更新 +git pull \ No newline at end of file diff --git a/05.auto_work/obsidian_push.bat b/05.auto_work/obsidian_push.bat new file mode 100644 index 0000000..a8906e5 --- /dev/null +++ b/05.auto_work/obsidian_push.bat @@ -0,0 +1,20 @@ +@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. +)