项目作者: PertapaCode

项目描述 :
A set of git tools based on A successful Git branching model
高级语言: JavaScript
项目地址: git://github.com/PertapaCode/gitf.git
创建时间: 2016-10-24T08:03:24Z
项目社区:https://github.com/PertapaCode/gitf

开源协议:MIT License

下载


gitf

A set of git tools based on A successful Git branching model

Overview

  • Start and finish a feature, release and hotfix branch.
  • Bump the version number.
  • Create a tag for release and hotfix.
  • Remove path from git history.

Good to know

  • Be sure you have a clean tree before running gitf.
  • When started will create the develop branch for you if doesn’t exist.
  • Uses the package.json to manage versions, folowing Semantic Versioning.

Install

To install gitf globaly run

  1. npm install gitf -g

or to install localy

  1. npm install gitf --save-dev

How it works

Use gitf in the command line or in node.

CLI

  1. gitf --help

Node

Options
  • path string
  • clearScreen Boolean
  • callback Function
  1. const Gitf = require('gitf')
  2. const gitf = new Gitf({
  3. path: './',
  4. clearScreen: true
  5. }, callback)

Create a feature branch

Create a feature branch from develop.

  1. gitf create-feature experiment
Options
  • branchName string
  • callback Function
  1. gitf.run('create-feature' 'experiment', callback)

Finish a feature branch

Merge the feature branch in develop and delete the feature branch.

  1. gitf finish-feature experiment
Options
  • branchName string
  • callback Function
  1. gitf.run('finish-feature' 'experiment', callback)

Create a release branch

Bump version, tag commit and create a release branch from develop.

  1. gitf create-release minor
Options
  • release string minor major
  • callback Function
  1. gitf.run('create-release' 'minor', callback)

Finish a release branch

Bump version and merge the release branch with develop.

  1. gitf finish-release 0.1
Options
  • releaseNumber string
  • callback Function
  1. gitf.run('finish-release' '0.1', callback)

Create a hotfix branch

Create a hotfix branch from a release branch.

  1. gitf create-hotfix 0.1
Options
  • releaseNumber string
  • callback Function
  1. gitf.run('create-hotfix' '0.1', callback)

Finish a hotfix branch

Bump version, tag commit and merge the hotfix branch with release branch.

  1. gitf finish-hotfix 0.1.1
Options
  • hotfixNumber string
  • callback Function
  1. gitf.run('finish-hotfix' '0.1.1', callback)

Remove a path from git history

Remove a path from git history for a specific branch.

  1. gitf remove-path path/to/remove master
Options
  • path string
  • branchName string
  • callback Function
  1. gitf.run('remove-path' 'path/to/remove', 'master', callback)

What happen behind?

Create a feature branch

  1. git checkout -b feature-* develop

Finish a feature branch

  1. git checkout develop
  2. git merge feature-*
  3. git branch -d feature-*

Create a release branch

  1. git checkout develop
  2. git commit -a -m "bumped version number to release-*.*.*-rc.1"
  3. git tag release-*.*.*-rc.1
  4. git checkout -b release-*.* develop

Bump version number in package.json after checkout develop

Finish a release branch

  1. git checkout develop
  2. git merge release-*.*

Create a hotfix branch

  1. git checkout -b hotfix-*.*.* release-*.*

Finish a hotfix branch

  1. git commit -a -m "bumped version number to *.*.*"
  2. git tag *.*.*
  3. git checkout release-*
  4. git merge hotfix-*
  5. git branch -d hotfix-*

Remove a path from git history

  1. git checkout *
  2. git filter-branch --tree-filter 'rm -rf *' --prune-empty HEAD &&
  3. git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d &&
  4. git gc

Contributing

Test

The unit test are written in Mocha.
Please add a unit test for every new feature or bug fix. npm test will run the tests.

Documentation

Please add documentation for every API change.

Feel free to contribute!

License

Copyright (c) 2017 Bruno Santos Licensed under the MIT license.