🌿 Git repository watching

Beyond copying files, the engine watches git repositories: it detects when a local repo has work that hasn't been pushed to the remote — the classic hole in code backups.

Git repository watching with per-repo status

What it does

  • Discovers .git directories under your roots (configurable in meta.repos_cfg; if empty, typical user roots).
  • One watcher per repo: when the .git changes (commit, checkout…), it reschedules the check immediately.
  • git ls-remote on its own cadence against the remote (system user credentials — GIT_TERMINAL_PROMPT=0 so it never hangs asking for a password).
  • Computes a risk score per repo (local commits without push, remote ahead, divergence) and publishes it to status.json → the app shows the icons.

Per-repo actions

From the app (POST /repos/{id}/action):

  • push — uploads the pending commits.
  • fetch — pulls down what's new from the remote.
  • pull --ff-only — fast-forward only, never a surprise merge.

A complement to the backup

The watched repo tells you "this code exists only here": copying the folder protects the files, but the unpushed commit is what really gets lost in a disaster. Watching warns you before it happens.