feat(auto_work : obsidian_sync)备份obsidian同步脚本
This commit is contained in:
parent
78a17a2843
commit
daa30910c5
9
05.auto_work/obsidian_pull.bat
Normal file
9
05.auto_work/obsidian_pull.bat
Normal file
@ -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
|
||||||
20
05.auto_work/obsidian_push.bat
Normal file
20
05.auto_work/obsidian_push.bat
Normal file
@ -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.
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue
Block a user