0

I am writing a script for reverting changes in all html files in certain folders(They are autogenerated). My current code looks like this -

var gulp = require('gulp');
var git = require('gulp-git');
var filelog = require('gulp-filelog');

gulp.task('reset-html-changes', function() {
    console.log('Resetting all HTML Files changes');
    return gulp.src(['app/*.html','app/modules/**/*.html','app/views/*.html'])
        .pipe(filelog())
        .pipe(git.checkoutFiles());
});

The problem with the above code is, it streams unchanged files too which takes a lot of time to process (2 mins approx). I just need the files which are changed and are currently in staged area, so that I can focus the processing towards staged and changed files only.

Is there any way I can do it using gulp-git, or do I have to use some other package for the same?

0xC0DED00D
  • 19,522
  • 20
  • 117
  • 184

0 Answers0