Skip to main content

Keep all your git forks up to date with the remote default branch.

Project description

Forks Sync

Keep all your git forks up to date with the remote default branch.

Build Status Coverage Status PyPi Licence

Showcase

If you manage more than a couple git forks, keeping them up to date with their remote default branch can be a pain. Forks Sync lets you avoid all the fuss by concurrently cloning each of your projects locally, adding the remote upstream, fetching new changes, rebasing your local default branch against the remote default branch, and force pushing to your repo's origin default branch - keeping all your forks up to date with the original repo.

By default, Forks Sync will save all your forks to ~/forks-sync where you can also find logs for this tool.

This tool will forcefully update the default branch of your fork to match the upstream default branch which could results in loss of changes if they are not committed on default branches.

Install

# Install tool
pip3 install forks-sync

# Install locally
just install

Usage

Usage:
    forks-sync --token 123

Options:
    -h, --help            show this help message and exit
    -t TOKEN, --token TOKEN
                            Provide your GitHub token to authenticate with the GitHub API.
    -f, --force           Pass this flag to force push changes to forked repos, otherwise the tool will run in "dry mode".
    -th THREADS, --threads THREADS
                            The number of threads to run.
    -to TIMEOUT, --timeout TIMEOUT
                            The number of seconds before a git operation times out.
    -l LOCATION, --location LOCATION
                            The location where you want your forks and logs to be stored.
    --version             show program's version number and exit

Authentication

There are two methods of authentication with this tool. The --token flag is required in addition to one of the following:

SSH

To allow the script to run continuosly without requiring passwords for every repo, you can add your SSH passphrase to the SSH agent:

# This assumes you've saved your SSH keys to the default location
ssh-add

You can then run a command similar to forks-sync --token 123 where the token is your GitHub API token. This will authenticate you with the GitHub API via the token and with GitHub via ssh.

Git Credential Manager

Alternatively, you can use a tool like Git Credential Manager to populate your Git credentials under the hood. When not using SSH, we'll clone from the git URLs instead of the SSH URLs. To trigger this behavior, you must pass the --https flag.

You can then run a command similar to forks-sync --token 123 --https where the token is your GitHub API token. This will authenticate you with the GitHub API via the token and with GitHub via your Git credentials via GCM.

Development

# Get a comprehensive list of development tools
just --list

# Run the tool locally
venv/bin/python forks_sync/sync.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

forks-sync-4.2.2.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

forks_sync-4.2.2-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file forks-sync-4.2.2.tar.gz.

File metadata

  • Download URL: forks-sync-4.2.2.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for forks-sync-4.2.2.tar.gz
Algorithm Hash digest
SHA256 1c09ee4c938279058afdb15d023da1a5870fd6919b2be790406e9ba7b79bf3bd
MD5 006c99102a150e026d9bb2df8cd52590
BLAKE2b-256 80624c0bf7943da517eaee695eedfd536b619ce083ada72530776b6e638ecc0e

See more details on using hashes here.

File details

Details for the file forks_sync-4.2.2-py3-none-any.whl.

File metadata

  • Download URL: forks_sync-4.2.2-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for forks_sync-4.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6e2edbd83f3878eb2228b591d696de1a81f01a90ac2d88b40358ea4d826a80e9
MD5 16053676cd48ff35160b8c4f66c46c30
BLAKE2b-256 5f879cdbad86f79d9f8a188eb19677b38805c30b47c1ce832d62e59f64d0add9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page