gulp-simple-git
v1.0.10
Published
auto git tool
Downloads
33
Readme
gulp-simple-git
Install
npm install --save-dev gulp-simple-git
Use
Gulp Task
const gulp = require('gulp');
const simpleGit = require('gulp-simple-git');
const gitOptions = {
remote: 'origin', //.........default => 'origin'
branch: 'master', //.........default => {local working branch}
addAll: true, //.............`git add .` :: default => false
commit: true, //.............`git commit` :: default => false
message: 'auto commit', //...`-m "message to commit"` :: default => [BRANCH: {currentBranch}] | [USER: {user}] | AUTO-COMMIT :: no message for commit.
push: true, //...............`git push` :: default => false
};
// gulp task with passed options
const { gitTask } = simpleGit(gitOptions);
// gulp task without passed options
const { gitTask } = simpleGit();
// gulp task with options
gulp.task('auto-git-add-commit-and-push', gulp.series(gitTask));
Command line options
-R, --remote "origin" #.........default => 'origin'
-B, --branch "master" #.........default => {local working branch}
-a #...........................`git add .` :: default => false
-c #...........................`git commit` :: default => false
-m "message to commit" #........`-m "message to commit"` :: default => [BRANCH: {currentBranch}] | [USER: {user}] | AUTO-COMMIT :: no message for commit.
-p #............................`git push` :: default => false
In additional to the message flag ( -m ), optional auto-generated messages can be generated:
-s #...STABLE
-b #...BROKEN
-f #...FEATURE
-x #...HOTFIX
In Use
-sm #...[BRANCH: {currentBranch}] | [USER: {user}] | STABLE :: no message for commit.
-bm #...[BRANCH: {currentBranch}] | [USER: {user}] | BROKEN :: no message for commit.
-fm #...[BRANCH: {currentBranch}] | [USER: {user}] | FEATURE :: no message for commit.
-xm #...[BRANCH: {currentBranch}] | [USER: {user}] | HOTFIX :: no message for commit.
Options object
const gitOptions = {
remote: 'origin', //.........default => 'origin'
branch: 'master', //.........default => {local working branch}
addAll: true, //.............`git add .` :: default => false
commit: true, //.............`git commit` :: default => false
message: 'auto commit', //...`-m "message to commit"` :: default => [BRANCH: {currentBranch}] | [USER: {user}] | AUTO-COMMIT :: no message for commit.
push: true, //...............`git push` :: default => false
};
Git Info
const gulp = require('gulp');
const simpleGit = require('gulp-simple-git');
const { gitInfo } = simpleGit();
const {
remotelyTrackedBranches, //...<object> with remote branches as key and an array of their respectively tracked branches
currentWorkingBranch, //......<string> name of the current working branch
remoteBranches, //............<array> of remote branches
localBranches, //.............<array> of local branches
user, //......................<string> git username
} = gitInfo;