gulp-gitstage

A plugin for Gulp to stage files in the object stream for git.


Keywords
gulp plugin, git, git stage, git add
License
MIT
Install
npm install gulp-gitstage@1.5.3

Documentation

gulp-gitstage

NPM version Build status Coverage Known Vulnerabilities License Prettier

plugin for gulp to stage files with git

Usage

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

First, install gulp-gitstage as a development dependency:

npm install --save-dev gulp-gitstage

Then, add it to your gulpfile.js:

const gitstage = require("gulp-gitstage");

const files = gulp.src("./src/*.ext").pipe(gitstage());

files.on("data", function (file) {
  console.log("Staged file:", file);
});

API

gitstage(options)

This plugin takes a single object as configuration. The available options are listed below. Note that all options are optional.

option type description default
gitCwd String Override from which directory git is executed. "./"
stagedOnly Boolean Only stage previously staged files. false

Examples

const gitstage = require("gulp-gitstage");

// Stage all files in the pipe
gulp.src("./**/*").pipe(gitstage());
const gitstage = require("gulp-gitstage");

// Stage files only if they're already staged
gulp.src("./**/*").pipe(gitstage({ stagedOnly: true }));

Help

Contributing to the project Read more in the Contributing Guidelines and Code of Conduct.
Known errors & solutions

git not found on your system.

The git command was not found in your environment variables. Read more here.

'gitCwd' must be a string.

The `gitCwd` option, as listed above, must be a string.

pathspec 'path/to/file' did not match any files

You are trying to add a file that does not exist in your project. Perhaps you're using gulp-rename before staging?

Unable to create '.../.git/index.lock': File exists.

The plugin is trying to run multiple instances of `git add` simultaneously. If you get this error report it immediately.