Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 2.37 KB

File metadata and controls

47 lines (31 loc) · 2.37 KB

git_auto_pull

Fast forward all git repos on a schedule.

Minimum Requirements

  • macOS
  • Linux (Red Hat family, Arch, and Ubuntu)

Install

curl -fsSL https://raw.githubusercontent.com/pythoninthegrass/git_auto_pull/main/install.sh | bash

Quickstart

By 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 EnvironmentVariables entry to ~/Library/LaunchAgents/com.pythoninthegrass.git-auto-pull.plist, then launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/com.pythoninthegrass.git-auto-pull.plist followed by re-running install.sh.
  • Linux: add Environment= lines under [Service] in ~/.config/systemd/user/git-auto-pull.service, then systemctl --user daemon-reload && systemctl --user restart git-auto-pull.timer.

Uninstall

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 -- --uninstall

Or from a local checkout:

./install.sh --uninstall