git-auto-fetch
Runs git fetch --all in the background every time the prompt appears inside a
repo, throttled to once per GIT_AUTO_FETCH_INTERVAL (default 60s). Fetches
are silent, non-interactive (SSH in BatchMode, no terminal prompts), and logged
to .git/FETCH_LOG.
Pro tips
- This is what keeps the spaceship prompt honest — the ⇣/⇡ behind/ahead
arrows only know about commits your local repo has fetched. With auto-fetch,
an agent pushing to gitea.stump.rocks from another session shows up in your
prompt within a minute, no manual
git fetchneeded. - Per-repo kill switch: run
git-auto-fetch(the function, no args) inside a repo to toggle it — it drops aNO_AUTO_FETCHguard file in.git/. Worth doing in huge or slow-remote repos. - The
--force-with-leasecaveat: because fetches happen behind your back, your lease is always "fresh" —gpfcan overwrite remote commits you never actually looked at. Solo on Gitea this rarely bites, but on shared GitHub branches, checkglolbefore force-pushing. - Debugging a repo that feels stale?
cat .git/FETCH_LOG— its mtime is the throttle timestamp, and fetch errors (dead remotes, auth failures) land there instead of your terminal. - It fetches all remotes, so repos with both a Gitea
originand a GitHubupstream(like the navidrome-ldap fork) stay current on both sides for free.