git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: M HickfordNext: Junio C Hamano
Message 2 of 8 in “Fetch remote only if remote hasn't been fetched recently”
  1. M HickfordJun 5, 2025
  2. Konstantin RyabitsevJun 5, 2025
  3. Junio C HamanoJun 5, 2025
  4. M HickfordJun 7, 2025
  5. Junio C HamanoJun 9, 2025
  6. M HickfordJun 11, 2025
  7. Junio C HamanoJun 11, 2025
  8. M HickfordJul 1, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.