Last updated on
Mac 自动 Commit 保存 Obsidian 历史信息
#!/bin/zsh
cd {obsidian 目录}
git add -A
# 生成提交信息,包含当前日期和时间
commit_message="commit-work-log: $(date '+%Y-%m-%d %H:%M:%S')"
git commit -m "$commit_message"
shell 输入 crontab -e
0 * * * * {上面脚本的所在目录}
解释各个字段:
0: 表示在每个小时的第0分钟执行。
*: 表示每个小时执行一次。
*: 表示任何一天。
*: 表示任何一个月。
*: 表示任何一周的星期几。
