6.0.6 • Published 9 days ago

one-way-git-sync v6.0.6

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
9 days ago

one-way-git-sync

Test semantic-release

:arrows_counterclockwise: A tool for synchronizing a destination git repository with a source git repository SAFELY.

It provides three features:

  1. replace the files of a destination repository (dest repo) with those of a source repository (src repo),
  2. add a replacement commit (sync commit) which whose message has the history of the included commits in the src repo and
  3. detect a conflict when a dest repo has a commit which a src repo doesn't have.

How to Use

Initial Usage

Because one-way-git-sync finds a sync commit from the commit history of the dest repo, you need to run one-way-git-sync with --force option to add an initial sync commit to the dest repo by replacing all the files of the dest repo with those of src repo at first. The sample command is as follows:

yarn dlx one-way-git-sync --force \
  -d git@github.com:WillBooster/sample-of-one-way-git-sync.git

If you have no permission to write git@github.com:WillBooster/sample-of-one-way-git-sync.git, please try https://oauth2:<GitHub Personal Access Token>@github.com/WillBooster/sample-of-one-way-git-sync.git. <GitHub Personal Access Token> should be like ghp_...m4rh.

Usual Usage

If the last commit in the dest repo is a sync commit, one-way-git-sync safely synchronizes the dest repo with the src repo. So, you don't need --force option. The sample command is as follows:

yarn dlx one-way-git-sync \
  -d git@github.com:WillBooster/sample-of-one-way-git-sync.git

Deal with Conflicts

If the last commit in the dest repo isn't a sync commit, the dest repo probably has some commits (conflict commits) which don't exist in the src repo. You need to merge missing commits in the src repo into the dest repo manually at first, then, you need to run one-way-git-sync with --force option. The sample commands are as follows:

  1. yarn dlx one-way-git-sync fails, then you notice there are missing commits
  2. (for merging) git remote add upstream git@github.com:WillBooster/sample-of-one-way-git-sync.git
  3. (for merging) git merge --allow-unrelated-histories upstream/main
  4. yarn dlx one-way-git-sync --force \
      -d git@github.com:WillBooster/sample-of-one-way-git-sync.git

Example Repository and Example GitHub Actions Workflows

  • sample-of-one-way-git-sync: an example synchronized repository.
  • release.yml: releases a new npm package and add a tag automatically in this repository using semantic-release.
  • sync.yml: it synchronizes sample-of-one-way-git-sync repository using one-way-git-sync when a new version is released.
  • force-sync.yml: we can manually trigger this workflow which forces synchronizing sample-of-one-way-git-sync repository.
6.0.6

9 days ago

6.0.3

15 days ago

6.0.5

15 days ago

6.0.4

15 days ago

6.0.2

2 months ago

6.0.1

4 months ago

5.0.1

11 months ago

6.0.0

10 months ago

5.0.0

12 months ago

4.2.2

1 year ago

4.2.1

2 years ago

4.1.2

2 years ago

4.2.0

2 years ago

3.4.0

2 years ago

3.5.0

2 years ago

4.1.0

2 years ago

4.0.0

2 years ago

4.1.1

2 years ago

3.3.1

2 years ago

3.1.3

2 years ago

3.3.0

2 years ago

3.1.2

2 years ago

3.2.0

2 years ago

3.1.4

2 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago