Re: Fetch remote only if remote hasn't been fetched recently
- From
Konstantin Ryabitsev <konstantin@linuxfoundation.org>
- Date
- Jun 5, 2025, 14:02 UTC
- Message-ID
- <20250605-flying-lemon-junglefowl-4c1d64@lemur>
- In-Reply-To
- <CAGJzqskDumbMSbC3rdYT8fZ8gNJ5MOjR_o8RAo9QS-nuvbBinQ@mail.gmail.com>
On Thu, Jun 05, 2025 at 12:16:26PM +0100, M Hickford wrote:
> Hi. I'd like to fetch from a particular remote, but only if that > remote hasn't been fetched in the last hour. How could I achieve this? > Is there a relevant option for `git fetch`?
Not to my knowledge, but you can either look at the timestamp of FETCH_HEAD (if that's the only remote you're fetching), or wrap git-fetch in a small script that touches .git/last-fetched-foo file and you can then check that file and exit if it's newer than 1 hour ago.
-K