npm-package

Clone Git repo to new one

Clone Git repo to new one with no connections to the original

The new repo will have an empty history and no remotes, everything else will be as in the original. Note that only the default branch (if more than one exists) will be cloned.

hh lohmann <hh.lohmann@gmail.com>

Synopsis

  import { gitCloneToNewRepo } from 'git-clone-to-new-repo'

  gitCloneToNewRepo( urlOfRepoToClone, nameForNewRepo )

  gitCloneToNewRepo( urlOfRepoToClone, nameForNewRepo, branchName )

Parameters

urlOfRepoToClone

URL of the repo to clone

nameForNewRepo

Name / path for repo to create

branchName

Optional: Name for branch with which new repo is created

Returns

Examples

  gitCloneToNewRepo(
    'https://github.com/acme-com/solve-all-problems',
    'my-super-solver'
  )

  gitCloneToNewRepo(
    'https://github.com/acme-com/postpone-hard-problems',
    '/home/joedoe/backlog/hard-problems'
  )

  gitCloneToNewRepo(
    'https://github.com/acme-com/soft-problems',
    'my-guaranteed-solver',
    'dev-branch'
  )

Installation

Pick for your preferred package manager:

  npm i git-clone-to-new-repo
  pnpm i git-clone-to-new-repo
  bun i git-clone-to-new-repo
  # For Yarn you should double check docs for your and / or
  # current Yarn version, newer versions do not treat `i package_name`
  # as an alias for `add ...` and exclude global installations
  yarn add git-clone-to-new-repo

Details

Source Code

License