Skip to content

HAKASHUN/gulp-git-staged

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-git-staged

You can get an object stream of git staged files on git.

TODO

WIP: This gulp plugin is a work in progress.

  • Add more test for this plugin.

Usage

You can get an object stream of git staged files on git.

First, install gulp-git-staged as a development dependency:

npm install --save-dev gulp-git-staged

Then, add it to your gulpfile.js:

var gitStaged = require("gulp-git-staged");

gulp.src("./src/*.ext")
	.pipe(gitStaged())
	.on('data', function (file) {
    console.log("Staged file:", file);
  });

API

git-staged(options)

options.status

Type: String
Default: AMRC

What status mode to look for.

A = added
M = modified
R = renamed
C = copied

EXAMPLE

We use this plugin for pre-commit task.

gulp.task('pre-commit', function(done) {
	gulp.src('./**/*')
			.pipe(gitStaged())
			.pipe(jshint())
			.pipe(jsbeautifier({
					config: '.jsbeautifyrc',
					mode: 'VERIFY_AND_WRITE'
			}))
			.pipe(gulp.dest('dest'))
			.pipe(git.add());
});			

License

MIT License

About

You can get an object stream of git staged files on git.

Resources

License

Stars

Watchers

Forks

Packages

No packages published