Giter Club home page Giter Club logo

forks-sync's Introduction

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

forks-sync's People

Contributors

justintime50 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

dheia

forks-sync's Issues

Allow Users to Specify Origin and Upstream Branches

With GitHub changing the default branch of repos from master to main, we'll need to add a way for users to specify not only their origin branch, but also the upstream branch to rebase/push to as these will probably start to diverge.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.