Smith Dwayne
Smith Dwayne

Reputation: 2807

Git Auto Commit Daily

Could I do take commit my changes in a directory by a daily routine? Say, In every 12 AM at early morning, It should commit all the changes in that directory automatically? Is it possible in git? I get some answers for auto commit for every changes. But I want it for daily once commit.

Upvotes: 9

Views: 8111

Answers (1)

Victor Wong
Victor Wong

Reputation: 3781

If you simply want to commit ALL changes every morning at 12 AM, you can do this using a cronjob.

Assuming that you are using a linux distribution with bash, you can write a bash script that does the commit

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

Then you can place this cron job in /etc/cron.d/

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

If you intend to run this as your own user only then you can instead add it to your personal crontab interactively by running

crontab -e

Upvotes: 11

Related Questions