git_afk watches your git repositories for uncommitted changes and automatically commits/pushes them
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-25 10:30:10 +02:00
.github/workflows fix: release workflow — drop windows target, correct tag var; portable watcher type 2026-09-25 10:29:59 +02:00
src fix: release workflow — drop windows target, correct tag var; portable watcher type 2026-09-25 10:29:59 +02:00
.gitignore fix: address independent review — gitignore filter, timeouts, git edge cases 2026-09-25 10:07:59 +02:00
AGENTS.md docs: trim AGENTS.md to the essentials 2026-09-25 10:15:38 +02:00
Cargo.lock fix: release workflow — drop windows target, correct tag var; portable watcher type 2026-09-25 10:29:59 +02:00
Cargo.toml fix: release workflow — drop windows target, correct tag var; portable watcher type 2026-09-25 10:29:59 +02:00
LICENSE LICENSE and README.md 2024-11-12 21:25:05 +01:00
README.md fix: address independent review — gitignore filter, timeouts, git edge cases 2026-09-25 10:07:59 +02:00
renovate.json Add renovate.json 2024-11-22 22:04:22 +00:00

git_afk

git_afk is a file watcher that should live as a daemon on the system to watch, commit, and push uncommited changes after a debounce time.

Motivation

Watch the selected repositories for changes in the worktree. If the changes in the worktree are not changed for predefined debounce time, it should if possible commit changes with specific commit message and try to push them. If the commit or the push fails. We can just reset the timer. If there are no changes it will use the same configured debounce time to pull changes from the remote.

Installation

You can either download latest binaries from github releases and put them into ~/.local/bin/ or /usr/local/bin/ or anywhere into your $PATH.

Second option is to install with cargo: cargo install git_afk

Running as a daemon

For the best convenience it is recommended to run the git_afk watch as a daemon on your system.

Linux

Copy this git_afk.service file to your services folders e.g. ~/.config/systemd/user/

[Unit]
Description=git_afk
After=ssh-agent.service
Requires=ssh-agent.service

[Service]
ExecStart=git_afk watch
Environment="SSH_AUTH_SOCK=/run/user/1000/keyring/ssh"
Restart=on-failure

[Install]
WantedBy=default.target

git_afk needs to be started with an ability to commit to git repository. If you use ssh connection to git it requires SSH_AUTH_SOCK to be specified in environment prior to running system service.

Operational notes

  • git_afk watch logs at info level by default, so successful commits/pushes/pulls and all recovery actions are visible in the systemd journal without extra flags (-q to quiet down, -v/-vv for more). Failures are always logged at error.
  • The daemon self-heals: if a repository stays dirty for two consecutive pull cycles without any commit (for example after a file-watcher failure), git_afk force-commits and rebuilds its file watchers instead of silently stalling forever.
  • Identical recurring failures are logged once per hour instead of every debounce cycle, so a broken repo does not flood the journal.
  • git_afk status reports daemon health (PID, watcher generation, freshness of the heartbeat) and per-repository facts (dirty tree, branch, last commit, pending change, next pull, dirty-pull streak). It exits non-zero when the daemon is not running or its heartbeat is stale — handy for cron/scripts.
  • Only watch repositories you trust: automatic commits run the repository's own git hooks.

Other systems

Create a launchd configuration file for your app. This involves creating a new file in /Library/LaunchAgents/ with a .plist extension, containing the necessary details like the executable path and startup order.

I am not able to compile/test functionality on other systems. I would recommend using launchd. Feel free to open issues/pull requests for additional functionality on other platforms.