A set of git tools based on A successful Git branching model
- 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.
- 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.
To install gitf globaly run
npm install gitf -g
or to install localy
npm install gitf --save-dev
Use gitf in the command line or in node.
gitf --help
path
stringclearScreen
Booleancallback
Function
const Gitf = require('gitf')
const gitf = new Gitf({
path: './',
clearScreen: true
}, callback)
Create a feature branch from develop.
gitf create-feature experiment
branchName
stringcallback
Function
gitf.run('create-feature' 'experiment', callback)
Merge the feature branch in develop and delete the feature branch.
gitf finish-feature experiment
branchName
stringcallback
Function
gitf.run('finish-feature' 'experiment', callback)
Bump version, tag commit and create a release branch from develop.
gitf create-release minor
release
string minor majorcallback
Function
gitf.run('create-release' 'minor', callback)
Bump version and merge the release branch with develop.
gitf finish-release 0.1
releaseNumber
stringcallback
Function
gitf.run('finish-release' '0.1', callback)
Create a hotfix branch from a release branch.
gitf create-hotfix 0.1
releaseNumber
stringcallback
Function
gitf.run('create-hotfix' '0.1', callback)
Bump version, tag commit and merge the hotfix branch with release branch.
gitf finish-hotfix 0.1.1
hotfixNumber
stringcallback
Function
gitf.run('finish-hotfix' '0.1.1', callback)
Remove a path from git history for a specific branch.
gitf remove-path path/to/remove master
path
stringbranchName
stringcallback
Function
gitf.run('remove-path' 'path/to/remove', 'master', callback)
git checkout -b feature-* develop
git checkout develop
git merge feature-*
git branch -d feature-*
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
git checkout develop
git merge release-*.*
git checkout -b hotfix-*.*.* release-*.*
git commit -a -m "bumped version number to *.*.*"
git tag *.*.*
git checkout release-*
git merge hotfix-*
git branch -d hotfix-*
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
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!
Copyright (c) 2017 Bruno Santos Licensed under the MIT license.