A plugin for Gulp to get an object stream of modified files on git.


gitmodified plugin for gulp

A plugin for Gulp to get an object stream of git status files on git (e.g. modified, deleted, untracked, etc).

First, install gulp-gitmodified as a development dependency:

npm install --save-dev gulp-gitmodified

Then, add it to your gulpfile.js:

var gitmodified = require('gulp-gitmodified');
var files = gulp.src('./src/*.ext')
files.on('data', function (file) {
  console.log('Modified file:', file);

For statusMode, you can pass a single string value or an array of string values.

gulp-gitmodified extends the vinyl file format gulp uses to have a method for checking if file is deleted. isDeleted is true if checking for deleted files (see below), and false otherwise.

Type: String || Array Default: 'modified'

What status mode to look for. From git documentation:

M = modified
A = added
D = deleted
R = renamed
C = copied
U = updated but unmerged
?? = untracked
!! = ignored

(and more if in short format (e.g. AM), see Short Format on git status man page)

// All added files 
// Equal to the one before 
// All added and modified files 
    .pipe(gitmodified(['added', 'modified']))
// All deleted files. 
    .on('data', function (file) {
      console.log(file.isDeleted()); //=> true 

MIT License