pushy-git regularly checks git repos for local changes and pushes them automatically to origin master.
I sync my dotfiles and my password keys using git, but usually forget to pull/push my changes on different computers. One lazy Sunday I wrote this to do it for me.
You need Git.
Tests run on Python 3.4 up to 3.7. Python 2 not supported.
Depends on the Click library for the CLI. Should work on *nix systems, maybe even including MacOS, but I bet this doesn't run on Windows.
This is intended to run in the background. For this to work you'll need to have your ssh keys set up all nice so that git isn't asking for your password.
You can install via pip:
pip install pushy-git
Then invoke the
pushy-git run command. You will be prompted to configure
Used to format commit strings. Example commit message:
myhost: 2018-02-18 12:23:03:04:32:12
Comma-separated list of repo file paths to check. Example:
~/.secrets, ~/.wishes, ~/.plans
time to sleep between scans, in seconds. Example:
5 (scans every five seconds)
You can reconfigure at any time using the
pushy-git config command, or
manually by editing the ~/.pushy-git JSON file. You can configure hidden
settings by running
pushy-git hidden. Hidden settings are documented in
the USAGE section.
Generally this can be run in the background with something like nohup (in a POSIX-like environment). Putting this command into your .bash_profile or equivalent shell file should launch the process on login:
nohup pushy-git run &
There is some minimal logging that will send output from the git commands
being run to (by default)
~/.config/pushy-git/log. If your XDG_CONFIG_HOME
environmental variable is set that will be respected and override the default
Commands are as follows:
Runs the utility.
Prompts you to set the options outlined above in the installation
pushy-git hidden Prompts you to set the options outlined above in the
installation section, plus these "hidden" settings not included in the regular
update commands: A comma-separated list of shell comands to be run upon changes being detected in a repo. Note that these commands will be run from the root directory of the git repo itself.
The git commit command will be formatted to include the hostname and current datetime at the time the commit is made.
git pull, git add ., git commit -m, git push -u origin master
If set to True, changes from remote branches of the repos are pulled down to
local before the initial scan begins. Default:
The future isn't real. Here are lies about what will happen in the future:
- Logging that is not an atrocity against the human spirit
- Testing that is not an atrocity against the human spirit
- Allow separate configurations for individual repos
You can reach me at email@example.com. I am happy for any feedback, questions, contributions, pull requests, or code review.