npm

Need private packages and team management tools?Check out npm Orgs. »

git-snapshot

2.0.0 • Public • Published

git-snapshot

npm npm (beta) NPM npm npm semantic-release

git-snapshot is a tool to take a snapshot of the directory and creates/updates another branch, like git subtree split --squash.

  • git-snapshot is a sub-command of git
  • The snapshot contains no commit histories
  • Simple and fast
  • Unlike git subtree split, you can split from the directory in which you want

Installation

Global installation

Install globally (add to your PATH) and you can use git-snapshot as a git sub-command.

$ npm install --save git-snapshot 

Local installation

For Node modules projects we recommend installing git-snapshot locally.

$ npm install --save git-snapshot 

Usage

CLI Usage

usage: git snapshot --prefix=<path> --branch=<branch> --message=<message>
[--tag=<tag>] [--remote=<repository>] [--dry-run] [--cwd=<path>]
 
Required
  --prefix, -p   the name of the subdir to split out             [string] [required]
  --branch, -b   the name of branch for split to                 [string] [required]
  --message, -m  commit message                                  [string] [required]
 
Options:
  --help, -h     Show help                                                 [boolean]
  --version, -v  Show version                                              [boolean]
  --allow-empty  allow empty commit                                        [boolean]
  --author, -a   override the commit author                                 [string]
  --force, -f    allow force commit, tag, push                             [boolean]
  --tag, -t      tag name                                                   [string]
  --remote, -r   remote repository                                          [string]
  --dry-run, -d  skip publishing                                           [boolean]
  --cwd, -c      working directory                                          [string]

Code Usage

const gitSnapshot = require('git-snapshot')
 
// Options are the same as command line, except camelCase
// gitSnapshot returns a Promise
gitSnapshot({
  prefix: './Packages/SomePackage',
  branch: 'upm',
  message: 'Release 1.0.0',
  allowEmpty: false,
  author: 'snapshot',
  force: false,
  tag: '1.0.0',
  remote: 'origin',
  dryRun: false,
  cwd: process.cwd(),
}).then(() => {
  // git-snapshot is done
}).catch(err => {
    console.error(`git-snapshot failed with message: ${err.message}`)
})

License

MIT

See Also

Patreon

install

npm i git-snapshot

Downloadsweekly downloads

143

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability