gitf

0.1.0 • Public • Published

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

npm install gitf -g

or to install localy

npm install gitf --save-dev

How it works

Use gitf in the command line or in node.

CLI

gitf --help

Node

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

Create a feature branch

Create a feature branch from develop.

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

Finish a feature branch

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

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

Create a release branch

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

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

Finish a release branch

Bump version and merge the release branch with develop.

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

Create a hotfix branch

Create a hotfix branch from a release branch.

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

Finish a hotfix branch

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

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

Remove a path from git history

Remove a path from git history for a specific branch.

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

What happen behind?

Create a feature branch

git checkout -b feature-* develop

Finish a feature branch

git checkout develop
git merge feature-*
git branch -d feature-*

Create a release branch

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

Bump version number in package.json after checkout develop

Finish a release branch

git checkout develop
git merge release-*.*

Create a hotfix branch

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

Finish a hotfix branch

git commit -a -m "bumped version number to *.*.*"
git tag *.*.*
git checkout release-*
git merge hotfix-*
git branch -d hotfix-*

Remove a path from git history

git checkout *
git filter-branch --tree-filter 'rm -rf *' --prune-empty HEAD &&
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d &&
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.

Readme

Keywords

Package Sidebar

Install

npm i gitf

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • pertapacode