A CLI tool for git state replication from one repository to another one.
Install it with a simple command:
go install github.com/Neurostep/git-replicator@latestusage: 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=Abc123Xyzgit-replicator <link-to-github-pull-request>git-replicator <link-to-git-repository>git-replicator -l <path-to-local-repository> -b <branch-name>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 commitgit-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.
MIT licensed. See the LICENSE file for details.