# gulp-git
**Repository Path**: mirrors_floatdrop/gulp-git
## Basic Information
- **Project Name**: gulp-git
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-24
- **Last Updated**: 2026-05-15
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
#gulp-git
[](https://travis-ci.org/stevelacy/gulp-git)
[](http://badge.fury.io/js/gulp-git)
| Package | gulp-git |
| Description |
Git plugin for Gulp (gulpjs.com) |
| Node Version |
>= 0.9 |
| Gulp Version |
3.x |
## Usage
### Install
npm install gulp-git --save
#### 0.4.0 introduced Breaking Changes!
Git actions which did not require a [Vinyl](https://github.com/wearefractal/vinyl) file were refactored.
Please review the following docs for changes:
##Example
```javascript
var gulp = require('gulp');
var git = require('gulp-git');
// Run git init
// src is the root folder for git to initialize
gulp.task('init', function(){
git.init();
});
// Run git init with options
gulp.task('init', function(){
git.init({args: '--quiet --bare'});
});
// Run git add
// src is the file(s) to add (or ./*)
gulp.task('add', function(){
return gulp.src('./git-test/*')
.pipe(git.add());
});
// Run git add with options
gulp.task('add', function(){
return gulp.src('./git-test/*')
.pipe(git.add({args: '-f -i -p'}));
});
// Run git commit
// src are the files to commit (or ./*)
gulp.task('commit', function(){
return gulp.src('./git-test/*')
.pipe(git.commit('initial commit'));
});
// Run git commit with options
gulp.task('commit', function(){
return gulp.src('./git-test/*')
.pipe(git.commit('initial commit', {args: '-A --amend -s'}));
});
// Run git remote add
// remote is the remote repo
// repo is the https url of the repo
gulp.task('remote', function(){
git.addRemote('origin', 'https://github.com/stevelacy/git-test');
});
// Run git push
// remote is the remote repo
// branch is the remote branch to push to
gulp.task('push', function(){
git.push('origin', 'master')
.end(); // .end() is required
});
// Run git push with options
// branch is the remote branch to push to
gulp.task('push', function(){
git.push('origin', 'master', {args: " -f"})
.end();
});
// Run git pull
// remote is the remote repo
// branch is the remote branch to pull from
gulp.task('pull', function(){
git.pull('origin', 'master', {args: '--rebase'});
});
// Clone a remote repo
gulp.task('clone', function(){
git.clone('https://github.com/stevelacy/gulp-git');
});
// Tag the repo with a version
gulp.task('tag', function(){
git.tag('v1.1.1', 'Version message');
});
// Tag the repo With signed key
gulp.task('tagsec', function(){
git.tag('v1.1.1', 'Version message with signed key', {args: "signed"});
});
// Create a git branch
gulp.task('branch', function(){
git.branch('newBranch');
});
// Checkout a git branch
gulp.task('checkout', function(){
return gulp.src('./*')
.pipe(git.checkout('branchName'));
});
// Merge branches to master
gulp.task('merge', function(){
git.merge('branchName');
});
// Reset a commit
gulp.task('reset', function(){
git.reset('SHA');
});
// Git rm a file or folder
gulp.task('rm', function(){
return gulp.src('./gruntfile.js')
.pipe(git.rm());
});
// Run gulp's default task
gulp.task('default',['add']);
```
##API
### git.init()
`git init`
Options: Object
`.init({args: 'options'})`
Creates an empty git repo
### git.add()
`git add `
gulp.src: required
Options: Object
`.add({args: 'options'})`
Adds files to repo
### git.commit()
`git commit -m `
gulp.src: required
Options: Object
`.commit('message', {args: 'options'})`
Commits changes to repo
`message` allows templates:
`git.commit('initial commit file: <%= file.path%>');`
### git.addRemote()
`git remote add `
defaults:
remote: 'origin'
Options: Object
`.addRemote('origin', 'git-repo-url', {args: 'options'})`
Adds remote repo url
### git.pull()
`git pull `
defaults:
remote: 'origin'
branch: 'master'
Options: Object
`.pull('origin', 'branch', {args: 'options'})`
Pulls changes from remote repo
### git.push()
`git push `
defaults:
remote: 'origin'
branch: 'master'
Options: Object
`.push('origin', 'master', {args: 'options'}).end()`
Pushes changes to remote repo
The stream `end` is required.
### git.tag()
`git tag -a/s -m `
Options: Object
Tags repo with release version
if options.signed is set to true, the tag will use the git secure key:
`git.tag('v1.1.1', 'Version message with signed key', {signed: true});`
### git.branch()
`git branch `
Options: Object
`.branch('newBranch', {args: "options"})`
Creates a new branch
### git.checkout()
`git checkout `
gulp.src: required
Options: Object
`.checkout('newBranch', {args: "options"})`
Checkouts a new branch with files
### git.merge()
`git merge `
Options: Object
`.merge('newBranch', {args: "options"})`
Merges a branch into master
### git.rm()
`git rm `
gulp.src: required
Options: Object
`.rm({args: "options"})`
Removes a file from git and deletes it
### git.reset()
`git reset `
Options: Object
`.reset('850f500f53f54', {args: "options"})`
Resets a git commit
### git.clone()
`git clone `
Options: Object
`.clone('https://remote.git', {args: "options"})`
Clones a remote repo
***
####You can view more examples in the [example folder.](https://github.com/stevelacy/gulp-git/tree/master/examples)
## LICENSE
(MIT License)
Copyright (c) 2014 Steve Lacy slacy.me - Fractal wearefractal.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.