Fast forward all git repos on a schedule.
- macOS
- Linux (Red Hat family, Arch, and Ubuntu)
curl -fsSL https://raw.githubusercontent.com/pythoninthegrass/git_auto_pull/main/install.sh | bashBy default, git_auto_pull.sh scans every repo under ~/git and fast-forwards any with a commit or fetch in the last 15 days. Override either with an environment variable before running the script directly:
GIT_AUTO_PULL_ROOT="$HOME/code" GIT_AUTO_PULL_DAYS=30 ~/.local/bin/git_auto_pull.sh| Variable | Default | Purpose |
|---|---|---|
GIT_AUTO_PULL_ROOT |
~/git |
Directory scanned for repos |
GIT_AUTO_PULL_DAYS |
15 |
Activity window, in days |
GIT_AUTO_PULL_LOG_DIR |
~/Library/Logs (macOS) / ~/.local/state/git-auto-pull (Linux) |
Log file directory |
The scheduler (launchd on macOS, systemd on Linux) runs the script with a clean environment, so overrides for scheduled runs must be set in the installed unit file rather than your shell. Both unit files ship with commented-out placeholders for GIT_AUTO_PULL_ROOT, GIT_AUTO_PULL_DAYS, and GIT_AUTO_PULL_LOG_DIR — uncomment and edit as needed:
- macOS: add an
EnvironmentVariablesentry to~/Library/LaunchAgents/com.pythoninthegrass.git-auto-pull.plist, thenlaunchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.pythoninthegrass.git-auto-pull.plistfollowed by re-runninginstall.sh. - Linux: add
Environment=lines under[Service]in~/.config/systemd/user/git-auto-pull.service, thensystemctl --user daemon-reload && systemctl --user restart git-auto-pull.timer.
Pass --uninstall to install.sh to remove the scheduler registration and ~/.local/bin/git_auto_pull.sh. Remotely, via curl | bash:
curl -fsSL https://raw.githubusercontent.com/pythoninthegrass/git_auto_pull/main/install.sh | bash -s -- --uninstallOr from a local checkout:
./install.sh --uninstall