git-snapshot
Take a snapshot of the directory - like 'git subtree split --squash'
Last updated 5 months ago by mob-sakai .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install git-snapshot 
SYNC missed versions from official npm registry.

git-snapshot

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

npm npm (beta) license downloads release semantic-release

Summary

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
  • Take a snapshot of the directory as a commit
  • Simple and fast
  • Unlike git subtree split, you can split from the directory in which you want

To take a snapshot, subtree split vs snapshot

subtree split snapshot
git subtree split --rejoin --prefix=path/to/target snapshot git snapshot --prefix=path/to/target --branch=snapshot
:+1: Official command
- Contain all history
:-1: Long commit log
:-1: No squash option
:-1: No support for moving target directory
- No history
:+1: Short commit log
:+1: Fast operation
:+1: Any target directory

Installation

Global installation

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

$ npm install -g 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
  --branch, -b   the name of branch for split to                 [string] [required]

Options:
  --help, -h     Show help                                                 [boolean]
  --version, -v  Show version                                              [boolean]
  --prefix, -p   the name of the subdir to split out                        [string]
  --message, -m  commit message                                             [string]
  --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]
  --debug        output debugging information                              [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',
  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

become_a_sponsor_on_github

Current Tags

  • 2.2.0-beta.2                                ...           beta (8 months ago)
  • 2.2.1                                ...           latest (5 months ago)

20 Versions

  • 2.2.1                                ...           5 months ago
  • 2.2.0                                ...           8 months ago
  • 2.2.0-beta.2                                ...           8 months ago
  • 2.2.0-beta.1                                ...           8 months ago
  • 2.1.0                                ...           8 months ago
  • 2.1.0-beta.4                                ...           8 months ago
  • 2.1.0-beta.3                                ...           9 months ago
  • 2.1.0-beta.2                                ...           9 months ago
  • 2.1.0-beta.1                                ...           9 months ago
  • 2.0.0                                ...           9 months ago
  • 2.0.0-beta.4                                ...           9 months ago
  • 2.0.0-beta.3                                ...           9 months ago
  • 2.0.0-beta.2                                ...           9 months ago
  • 2.0.0-beta.1                                ...           9 months ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.1.0                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (11)

Copyright 2014 - 2016 © taobao.org |