Skip to content

Neurostep/git-replicator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-replicator

A CLI tool for git state replication from one repository to another one.

Installation

Install it with a simple command:

go install github.com/Neurostep/git-replicator@latest

Usage

usage: git-replicator <optional url>

Options:
  -b string
    	Repository branch name to replicate from (default "main")
  -l string
    	Path to local repository to replicate from
  -n int
    	Number of commits to replicate
  -r string
    	Repository remote (default "origin")

To authenticate requests to remote git repositoriesgit-replicator uses GIT_AUTH_TOKEN environment variable.

To set GIT_AUTH_TOKEN environment variable:

$ export GIT_AUTH_TOKEN=Abc123Xyz

Examples

Replicate commits from github pull request

git-replicator <link-to-github-pull-request>

Replicate commits from remote git repository by specifying URL

git-replicator <link-to-git-repository>

Replicate commits from the local repository and specified branch

git-replicator -l <path-to-local-repository> -b <branch-name>

How it works

If the remote repository URL is provided, gir-replicator will try to clone the repo locally into the directory specified in environment variable GITREPLICATOR_HOME, or by default in ~/.gitreplicator. For the local repository, it will get the necessary data from the specified local repository.

Next, git-replicator will ask for a confirmation of applying the number of commits. If GitHub Pull Request URL was provided, it will try to replicate the number of commits from the Pull Request. Otherwise, it will use either default number of commits (5), or user specified (-n <number-of-commits-to-replicate>).

To control, which commits to pick and which to drop, git-replicator uses the following format:

git-replicator <github-pull-request-url>
We are about to replicate 1 commits, proceed? yes / no? no

pick 35e752f27e16e16a4d74aee7eb96f21f894b8139 Test PR

Commands:
pick <commit> = use commit
drop <commit> = remove commit

git-replicator will try to use editor specified in either GIT_EDITOR or EDITOR environment variables. Otherwise, by default, it will try to use vi as editor.

If the particular patch couldn't be applied, git-replicator will suggest editing patch file, otherwise the patch will be skipped.

License

MIT licensed. See the LICENSE file for details.

About

Replicate your git state from repo to repo

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages