0.1.3 • Published 11 months ago

@bernankez/git-sync v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

git-sync

npm CI LICENSE

Auto sync repos when pushing to git.

Install

git-sync should be installed in your project instead of globally.

$ npm i -D @bernankez/git-sync

Usage

  1. Create a config file named gitsync.config.ts or gitsync.config.js in the root of your project. For example

gitsync.config.ts

import { defineConfig } from "@bernankez/git-sync";

export default defineConfig({
  remoteName: "origin",
  url: ["git@github.com:Bernankez/git-sync.git", "git@github.com:Bernankez/example.git"]
});
  1. Run the CLI to update git config
$ npx git-sync
  1. You can also add the CLI to your package.json, so it can automatically run after npm install
{
  "scripts": {
    "prepare": "git-sync"
  }
}

!NOTE If you accidentally set the wrong git url and it has been added to your git, please go to the [project root dir]/.git and remove the line url = [your incorrect git url] in the config file.

Configuration

CLI

--config \<path>

Specific where you want to read the config file from.

--git \<path>

Specific git base dir.

Configuration file

remoteName

Remote name, defaults to origin.

fetch

If remoteName is not added, fetch will be used as the parameter when adding remote.

url

Git urls that you want to push to.

gitBaseDir

Same as --git in CLI. --git has higher priority than gitBaseDir.

What's behind

git init
git remote add <config.remoteName> <config.fetch>
git remote set-url --add <config.remoteName> <config.url>
git remote -v

License

MIT License © 科科Cole

0.1.3

11 months ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago