chornge
chornge

Reputation: 2111

How do I git pull at a specific date or time?

I want to run the command (git pull origin 02:00:00) or something like that and leave, and at that time my local repo grab the latest files from the remote repo automatically.

I am working with a coworker and he said he should have something for me to pull by a specific time (say 2 hours from now). I've seen searching and all I can find are guides/tutorials/tips on how to do a git checkout by date, or retrieve files of a certain date.

Is that even possible or would I need to physically type in the command in my terminal?

Upvotes: 2

Views: 1259

Answers (1)

janos
janos

Reputation: 124666

If you want to run Git commands at some future time, that's not a Git feature, that's a scheduling task. One tool you can use is the at command, for example:

at now + 2 hours

This will give you a prompt, typically at>, where you can type commands to run later, for example git pull. After you typed all the commands you want to run, press Control-D to complete the at command.

Another solution is to sleep for two hours and then do git pull:

sleep 7200 && git pull

Yet another solution is to use cron.

Upvotes: 5

Related Questions