@bernankez/git-sync
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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"
  }
}

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

Readme

Keywords

none

Package Sidebar

Install

npm i @bernankez/git-sync

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

8.16 kB

Total Files

10

Last publish

Collaborators

  • bernankez