pushy-git

pushy-git automatically syncs local/remote branches


Keywords
git cli automate, pushy
License
GPL-3.0
Install
pip install pushy-git==0.6

Documentation

Build Status

pushy-git

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.

REQUIREMENTS

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.

INSTALLATION

You can install via pip:

pip install pushy-git

Then invoke the pushy-git run command. You will be prompted to configure these settings:

hostname:
Used to format commit strings. Example commit message:
myhost: 2018-02-18 12:23:03:04:32:12

repos:
Comma-separated list of repo file paths to check. Example: ~/.secrets, ~/.wishes, ~/.plans

sleep time:
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.

USAGE

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 ~/.config directory.

Commands are as follows:

pushy-git run Runs the utility.

pushy-git config Prompts you to set the options outlined above in the installation section.

pushy-git hidden Prompts you to set the options outlined above in the installation section, plus these "hidden" settings not included in the regular configuration process:

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.

Default: git pull, git add ., git commit -m, git push -u origin master

initial pull: If set to True, changes from remote branches of the repos are pulled down to local before the initial scan begins. Default: true

FUTURE

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

CONTACT

You can reach me at psbleep@protonmail.com. I am happy for any feedback, questions, contributions, pull requests, or code review.