Git Auto Commit Daily

问题描述 投票:1回答:1

我可以通过日常例程在目录中提交我的更改吗?比如说,在凌晨12点,它应该自动提交该目录中的所有更改?在git中有可能吗?我为每个更改获得了自动提交的答案。但我想每天提交一次。

linux git git-commit
1个回答
2
投票

如果您只想在每天早上12点提交所有更改,则可以使用cronjob执行此操作。

假设您正在使用带有bash的Linux发行版,您可以编写一个执行提交的bash脚本

#!/bin/bash
cd <git directory> && git add -A && git commit * --allow-empty-message -m ''

然后你可以将这个cron作业放在/etc/cron.d/中

0 0 * * * <username> /bin/bash <script location>

如果您打算仅以自己的用户身份运行此操作,则可以通过运行以交互方式将其添加到个人crontab中

crontab -e
© www.soinside.com 2019 - 2024. All rights reserved.