{"id":19339737,"url":"https://github.com/rubenv/grunt-git","last_synced_at":"2025-04-12T19:47:26.047Z","repository":{"id":7312463,"uuid":"8630443","full_name":"rubenv/grunt-git","owner":"rubenv","description":"Git commands for grunt.","archived":false,"fork":false,"pushed_at":"2021-08-13T08:07:05.000Z","size":299,"stargazers_count":227,"open_issues_count":36,"forks_count":83,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-12-30T12:46:34.817Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubenv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-07T15:34:11.000Z","updated_at":"2024-07-03T15:40:18.000Z","dependencies_parsed_at":"2022-09-10T03:10:56.142Z","dependency_job_id":null,"html_url":"https://github.com/rubenv/grunt-git","commit_stats":null,"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fgrunt-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fgrunt-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fgrunt-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubenv%2Fgrunt-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubenv","download_url":"https://codeload.github.com/rubenv/grunt-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625497,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:23:38.195Z","updated_at":"2025-04-12T19:47:26.021Z","avatar_url":"https://github.com/rubenv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-git\n\n\u003e Git commands for grunt.\n\n[![npm version](https://img.shields.io/npm/v/grunt-git?color=blue)](https://www.npmjs.com/package/grunt-git)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Built with Grunt](https://cdn.gruntjs.com/builtwith.svg)](https://gruntjs.com/)\n[![Build Status](https://travis-ci.org/rubenv/grunt-git.png?branch=master)](https://travis-ci.org/rubenv/grunt-git)\n[![dependencies](https://david-dm.org/rubenv/grunt-git.svg)](https://david-dm.org/)\n\n## Getting Started\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-git --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-git');\n```\n\n### Upgrading from v0.2.x\nThe `gitcommit` command used to call `git add` for you. This is no longer the case. Be sure to add a `gitadd` task whenever there might be new files to commit. The `ignoreEmpty` option is no longer supported.\n\n## Universal options\nThe following options may be applied to any task\n\n#### options.verbose\nType: `Boolean`\nDefault value: `none`\n\nConsole output from the git task will be piped to the output of the grunt script. Useful for debugging.\n\n#### options.cwd\nType: `string`\nDefault value: `none`\n\nChange the current working directory before executing the git call. Useful for performing operations on repositories that are located in subdirectories.\n**Note:** When performing commands that provide files (e.g. gitcommit), it is also necessary to specify the ``cwd`` for the files explicitly.\n\n#### Example:\n```js\ngrunt.initConfig({\n  gitcommit: {\n    your_target: {\n      options: {\n        cwd: \"/path/to/repo\"\n      },\n      files: [\n        {\n          src: [\"fileone.txt\", \"filetwo.js\"],\n          expand: true,\n          cwd: \"/path/to/repo\"\n        }\n      ]\n    }\n  },\n})\n```\n\n## The \"gitadd\" task\n\nAdd file contents to the index\n\n### Options\n\n#### options.all\nType: `Boolean`\nDefault value: `false`\n\nUpdate the index not only where the working tree has a file matching \u003cpathspec\u003e but also where the\nindex already has an entry. This adds, modifies, and removes index entries to match the working tree.\n\n#### options.force\nType: `Boolean`\nDefault value: `false`\n\nAllow adding otherwise ignored files.\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n  gitadd: {\n    task: {\n      options: {\n        force: true\n      },\n      files: {\n        src: ['test.txt']\n      }\n    }\n  },\n});\n```\n\n## The \"gitcommit\" task\n\nCommits the working directory.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitcommit` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitcommit: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      },\n      files: {\n          // Specify the files you want to commit\n      }\n    }\n  },\n})\n```\n\nEach target defines a specific git task that can be run. The different available tasks are listed below.\n\n### Options\n\n#### options.message\nType: `String`\nDefault value: `'Commit'`\n\nThe commit message.\n\n#### options.description\nType: `String`\nDefault value: `false`\n\nThe commit description.\n\n#### options.allowEmpty\nType: `Boolean`\nDefault value: `false`\n\nWhen `true`, the task will not fail when there are no staged changes (optional).\n\n#### options.noVerify\nType: `Boolean`\nDefault value: `false`\n\nWhen `true`, the task will commit the changes with the `--no-verify` flag.\n\n#### options.noStatus\nType: `Boolean`\nDefault value: `false`\n\nWhen `true`, the task will commit the changes with the `--no-status` flag.\n\n### Usage Examples\n\nCommit options:\n\n* `message`: Commit message\n* `files`: Files to commit\n* `noVerify`: Bypass the pre-commit and commit-msg hooks when committing changes\n* `noStatus`: Do not include the output of `git-status` in the commit message\n\n```js\ngrunt.initConfig({\n    gitcommit: {\n        task: {\n            options: {\n                message: 'Testing',\n                noVerify: true,\n                noStatus: false\n            },\n            files: {\n                src: ['test.txt']\n            }\n        }\n    },\n});\n```\n\n\n## The \"gitrebase\" task\n\nRebases the current branch onto another branch\n\n### Options\n\n#### options.branch (required)\nType: `String`\nthe name of the branch you want to rebase **on to**.  For example if the current branch were `codfish` and you wanted to rebase it onto `master`, you would set this value to `master`.\n\n#### options.theirs\nType: `Boolean`\n  Default value: `false`\n\nWhen true, use the git equivalent of svn's `theirs-conflict` (`--strategy=recursive -Xtheirs`).\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n  gitrebase: {\n    task: {\n      options: {\n        branch: 'master'\n      }\n    }\n  },\n});\n```\n\n## The \"gittag\" task\n\nCreates (or deletes) a git tag.\n\n### Overview\nIn your project's Gruntfile, add a section named `gittag` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gittag: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      }\n    }\n  },\n})\n```\n\nEach target defines a specific git task that can be run. The different available tasks are listed below.\n\n### Options\n\n#### options.tag\nType: `String`\nDefault value: `''`\n\nThe name of the tag. E.g.: `0.0.1`.\n\n#### options.message\nType: `String`\nDefault value: `''`\n\nThe tag message (optional).\n\n#### options.remove\nType: `Boolean`\nDefault value: `false`\n\nWhether to delete the tag (optional).\n\n#### options.annotated\nType: `Boolean`\nDefault value: `false`\n\nWhether to create an annotated tag (optional).\n\n#### options.force\nType: `Boolean`\nDefault value: `false`\n\nWhether to force to create or update the tag (optional).\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gittag: {\n        addtag: {\n            options: {\n                tag: '0.0.1',\n                message: 'Testing'\n            }\n        },\n        deletetag: {\n            options: {\n                tag: '0.0.1',\n                remove: true\n            }\n        }\n    },\n});\n```\n\n## The \"gitcheckout\" task\n\nCreates a git branch using checkout -b, or checks out a given branch.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitcheckout` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitcheckout: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      }\n    }\n  },\n})\n```\n\nEach target defines a specific git task that can be run. The different available tasks are listed below.\n\n### Options\n\n#### options.branch\nType: `String`\nDefault value: `''`\n\nThe name of the branch. E.g.: `testing`.\n\n#### options.create\nType: `Boolean`\nDefault value: `false`\n\nWhether the branch should be created (optional).\n\n#### options.force\nType: `Boolean`\nDefault value: `false`\n\nWhether the checkout should be forced in the case of git errors (optional)\n\n#### options.overwrite\nType: `Boolean`\nDefault value: `false`\n\nWhether the branch should be overwritten, or created if it doesn't already exist (optional).\n\n**NOTE:** When enabled, this option overwrites the target branch with the current branch.\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gitcheckout: {\n        task: {\n            options: {\n                branch: 'testing',\n                create: true\n            }\n        }\n    },\n});\n```\n\n## The \"gitstash\" task\n\nStash the changes in a dirty working directory away.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitstash` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitstash: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      }\n    }\n  },\n})\n```\n\nEach target defines a specific git task that can be run. The different available tasks are listed below.\n\n### Options\n\n#### options.command\nType: `String`\nDefault value: `'save'`\n\nThe stash command to run. E.g.: `save`, `apply`.\n\n#### options.stash\nType: `Integer`\nDefault value: `''`\n\nThe stash to apply. E.g.: `0` (optional).\n\n#### options.staged\nType: `Boolean`\nDefault value: `false`\n\nWhether the staged changes should be reapplied (optional).\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gittag: {\n        stash: {\n            options: {\n                create: true\n            }\n        },\n        apply: {\n            options: {\n                command: 'apply',\n                staged: true,\n                stash: '0'\n            }\n        }\n    },\n});\n```\n\n## The \"gitclone\" task\n\nClones a git repo.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitclone` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitclone: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      }\n    }\n  },\n})\n```\n\nEach target defines a specific git task that can be run. The different available tasks are listed below.\n\n### Options\n\n#### options.bare\nType: `Boolean`\nDefault value: none\n\nRun git clone with the `--bare` option applied.\n\n#### options.branch\nType: `String`\nDefault value: none\n\nClone the repo with a specific branch checked out. (Cannot be used in conjunction with 'bare')\n\n#### options.depth\nType: `Integer`\nDefault value: none\n\nClone the repo with a limited revision history. (Such clones cannot be pushed from or pulled to.)\n\n#### options.repository (required)\nType: `String`\nDefault value: none\n\nThe path to the repository you want to clone.\n\n#### options.directory\nType: `String`\nDefault value: none\n\nClone the repo into a specific directory instead of the one git decides.\n\n#### options.recursive\nType: `Boolean`\nDefault value: none\n\nPass the --recursive flag to the git clone command. This is equivalent to running git submodule update --init --recursive immediately after the clone is finished.\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gitclone: {\n        clone: {\n            options: {\n                repository: 'https://github.com/you/your-git-repo.git',\n                branch: 'my-branch',\n                directory: 'repo'\n            }\n        }\n    },\n});\n```\n\n## The \"gitreset\" task\n\nCreates a git branch using checkout -b, or checks out a given branch.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitreset` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitreset: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      },\n      files: {\n        src: // Target-specific files go here.\n      }\n    }\n  },\n})\n```\n\nEach target defines a specific git task that can be run. The different available tasks are listed below.\n\n### Options\n\n#### options.mode\nType: `String`\nDefault value: `''`\n\nThe reset mode to run. E.g.: `hard`, `merge`.\n\n#### options.commit\nType: `String`\nDefault value: `'HEAD'`\n\nWhich commit to reset to (optional).\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gitreset: {\n        task: {\n            options: {\n                mode: 'hard',\n                commit: 'HEAD~1'\n            }\n        }\n    },\n});\n```\n## The \"gitrm\" task\n\nRemoves files from git's working tree and index.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitrm` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitrm: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      },\n      files: {\n        src: // Target-specific files go here.\n      }\n    }\n  },\n})\n```\n\nEach target defines a specific git task that can be run. The different available tasks are listed below.\n\n### Options\n\n#### options.force\nType: `Boolean`\nDefault value: `false`\n\nWill force a removal of the files listed in the configuration.\n\n#### options.recurse\nType: `Boolean`\nDefault value: `false`\n\nWill recurse into subdirectories if specified in the configuration.\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gitrm: {\n        task: {\n            options: {\n                force: 'true'\n            },\n            files: {\n                src: ['dist/test.min.js']\n            }\n        }\n    },\n});\n```\n\n## The \"gitclean\" task\n\nRemove untracked files from the working tree.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitclean` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitclean: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      },\n      files: {\n        src: // Target-specific paths go here (optional).\n      }\n    }\n  },\n})\n```\n\n### Options\n\n#### options.force\nType: `Boolean`\nDefault value: `true`\n\nForce a run of the clean command (optional).\n\n#### options.dry\nType: `Boolean`\nDefault value: `false`\n\nDon't actually remove anything, just show what would be done (optional).\n\n#### options.quiet\nType: `Boolean`\nDefault value: `false`\n\nBe quiet, only report errors, but not the files that are successfully removed (optional).\n\n#### options.exclude\nType: `String`/`Array`\nDefault value: `false`\n\nIn addition to those found in .gitignore (per directory) and $GIT_DIR/info/exclude, also consider the given patterns to be in the set of the ignore rules in effect (optional).\n\nIn case it's needed to provide multiple patterns one should use an array:\n\n```js\ngrunt.initConfig({\n  gitclean: {\n    your_target: {\n      options: {\n        exclude: ['.env', 'config.php']\n      },\n      ...\n    }\n  },\n})\n```\n\n#### options.onlyignorefiles\nType: `Boolean`\nDefault value: `false`\n\nRemove only files ignored by Git. This may be useful to rebuild everything from scratch, but keep manually created files (optional).\n\n#### options.nonstandard\nType: `Boolean`\nDefault value: `false`\n\nDon't use the standard ignore rules read from .gitignore (per directory) and $GIT_DIR/info/exclude, but do still use the ignore rules given with this option. This allows removing all untracked files, including build products. This can be used (possibly in conjunction with git reset) to create a pristine working directory to test a clean build (optional).\n\n#### options.directories\nType: `Boolean`\nDefault value: `false`\n\nRemove untracked directories in addition to untracked files. If an untracked directory is managed by a different Git repository, it is not removed by default (optional).\n\n## The \"gitpush\" task\n\nPushes to a remote.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitpush` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitpush: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      }\n    }\n  },\n})\n```\n\n### Options\n\n#### options.remote\nType: `String`\nDefault value: `'origin'`\n\nThe remote where to push. E.g.: `origin`, `heroku`. The task will push to `origin` if left unset.\n\n#### options.branch\nType: `String`\nDefault value: `null`\n\nThe remote branch to push to. E.g.: `master`, `develop`. The task will push to the tracked branch if left unset.\n\n#### options.all\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--all` flag to the push.\n\n#### options.tags\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--tags` flag to the push.\n\n#### options.upstream\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--set-upstream` flag to the push.\n\n#### options.force\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--force` flag to the push.\n\n## The \"gitpull\" task\n\nPulls from a remote.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitpull` to the data object passed into `grunt.initConfig()`.\nYou can change the remote (origin is by default), and you can add a branch you want to pull from.\n\n```js\ngrunt.initConfig({\n  gitpull: {\n    your_target: {\n      options: {\n\n      }\n    }\n  },\n})\n```\n\n### Options\n\n#### options.remote\nType: `String`\nDefault value: `origin`\n\nThe remote to pull from. The task will not fail if the origin is left unset and pull the default remote git origin.\n\n#### options.branch\nType: `String`\nDefault value: `master`\n\nThe branch to pull from. E.g.: `master`, `develop` (optional).\n\n## The \"gitfetch\" task\n\nDownload objects and refs from a repo.\n\n### Overview\n\nIn your project's Gruntfile, add a section named `gitfetch` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitfetch: {\n    your_target: {\n      options: {\n        all: true\n      }\n    }\n  }\n})\n```\n\n### Options\n\n#### options.repository\nType: `String`\nDefault value: `null`\n\nThe repository you want to fetch from. When no remote is specified, by default the origin remote will be used.\n\n#### options.all\nType: `Boolean`\nDefault value: `false`\n\nAdds the `--all` flag. Fetch all remotes.\n\n#### options.append\nType: `Boolean`\nDefault value: `false`\n\nAdds the `--append` flag. Append ref names and object names of fetched refs.\n\n#### options.prune\nType: `Boolean`\nDefault value: `false`\n\nAdds the `--prune` flag. After fetching, remove any remote-tracking references that no longer exist on the remote.\n\n#### options.notags\nType: `Boolean`\nDefault value: `false`\n\nAdds the `--no-tags` flag. Disables automatic tag following.\n\n#### options.tags\nType: `Boolean`\nDefault value: `false`\n\nAdds the `--tags` flag. Fetch all tags from the remote into local.\n\n## The \"gitrevParse\" task\n\nPick out and massage parameters.\n\n### Overview\n\nIn your project's Gruntfile, add a section named `gitrevParse` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitrevParse: {\n    your_target: {\n      options: {\n        short: 7,\n        treeIsh: 'master',\n        prop: 'gitrevParse.your_target.result',\n        callback: function(result) {\n          grunt.gitrevParse.your_target.result = result;\n        }\n      }\n    }\n  }\n})\n```\n\n### Options\n\n#### options.short\nType: `Integer`\nDefault value: none.\n\nAdds the `--short=` option, set to the specified number of characters.\n\n#### options.treeIsh\nType: `String`\nDefault value: `'HEAD'`\n\nThe tree or commit object to examine.\n\n#### options.abbrevRef\nType: `Boolean`\nDefault value: `false`\n\nAdds the `--abbrev-ref` flag. Try and output the abbreviated reference for the tree-ish object instead of the SHA-1 checksum.\n\n#### options.prop\nType: `String`\nDefault value: `'gitrevParse.\u003ctarget name\u003e.result'`.\n\nThe grunt property in which to store the results.\n\n#### options.callback\nType: `Function`\nDefault value: none.\n\nA callback function that is called with the rev-parse results provided as the sole parameter.\n\n## The \"gitmerge\" task\n\nMerges another branch into the current branch.\n\n### Overview\nIn your project's Gruntfile, add a section named `gitmerge` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitmerge: {\n    your_target: {\n      options: {\n        // Target-specific options go here.\n      }\n    }\n  },\n})\n```\n\n### Options\n\n#### options.branch\nType: `String`\nDefault value: `null`\n\nThe branch to merge from. E.g.: `master`, `develop`. The task will fail if the branch if left unset.\n\n#### options.ffOnly\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--ff-only` flag to the merge.\n\n#### options.noff\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--no-ff` flag to the merge.\n\n#### options.nolog\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--no-log` flag to the merge.\n\n#### options.squash\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--squash` flag to the merge.\n\n#### options.edit\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--edit` flag to the merge: this forces an editor to appear before committing the successful merge.\n\n#### options.noEdit\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--no-edit` flag to the merge: this bypasses the editor from appearing before committing a successful merge.\n\n#### options.message\nType: `String`\nDefault value: `null`\n\nWill add the `-m` flag followed by the value of this option to the merge: this string will be used as the commit message for the merge.\n\n#### options.commit\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--commit` flag to the merge: this option can be used to override ``-no-commit`` in the git config.\n\n#### options.noCommit\nType: `Boolean`\nDefault value: `false`\n\nWill add the `--no-commit` flag to the merge: do not commit the merge.\n\n#### options.strategy\nType: `String`\nDefault value: `null`\n\nWill add the `-s` flag followed by the value of this option to the merge: this string will be used to specify the strategy for the merge.\n\n#### options.strategyOption\nType: `String`\nDefault value: `null`\n\nWill add the `-X` flag followed by the value of this option to the merge: this string will be used to specify a strategy-specific option for the merge.\n\n## The \"gitarchive\" task\n\nArchives a branch.\n\n### Overview\n\nIn your project's Gruntfile, add a section named `gitarchive` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitarchive: {\n    master: {\n      options: {\n        format: 'tar.gz',\n        prefix: 'your-project-name/',\n        treeIsh: 'master',\n        output: '/tmp/your-project-name.tar.gz',\n        path: ['README', 'LICENSE']\n      }\n    }\n  }\n})\n```\n\n### Options\n\n#### options.treeIsh\nType: `String`\nDefault value: `'master'`.\n\nThe tree or commit to produce an archive for. E.g.: `'master'` or a commit hash.\n\n#### options.format\nType: `String`\nDefault value: `'tar'`.\n\nFormat of the resulting archive: `'tar'`, `'tar.gz'`, `'zip'`. If this option is not given, and the output file is specified, the format is inferred from the filename if possible (e.g. writing to \"foo.zip\" makes the output to be in the zip format). Otherwise the output format is tar.\n\n#### options.prefix\nType: `String`\nDefault value: none.\n\nAdds the `--prefix` flag. Don't forget the trailing `/`.\n\n#### options.output\nType: `String`\nDefault value: none.\n\nAdds the `--output` flag. Write the archive to a file instead of `stdout`.\n\n#### options.remote\nType: `String`\nDefault value: none.\n\nAdds the `--remote` flag. Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.\n\n#### options.path\nType: `Array`\nDefault value: none.\n\nWithout an optional `path` parameter, all files and subdirectories of the current working directory are included in the archive. If one or more paths are specified, only these are included.\n\n\n## The \"gitlog\" task\n\nLogs commit history and stores the result in a grunt property or calls a callback function with the result. The result is an array of objects with the following properties:\n\n* `hash` - the commit hash\n* `author` - an object with `name` and `email` properties\n* `date` - the date of the commit\n* `subject` - the subject string of the commit\n* `body` - the body string of the commit\n\n### Overview\n\nIn your project's Gruntfile, add a section named `gitlog` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitlog: {\n    mytarget: {\n      options: {\n        prop: 'gitlog.mytarget.result',\n        from: 'v0.2.0',\n        to: 'v0.2.2'\n      }\n    }\n  }\n})\n```\n\n### Options\n\n#### options.prop\nType: `String`\nDefault value: `'gitlog.\u003ctarget name\u003e.result'`.\n\nThe grunt property in which to store the results.\n\n#### options.callback\nType: `Function`\nDefault value: none.\n\nA callback function to call with the log results.\n\n#### options.pretty\nType: `String`\nDefault value:\n```\n    'format:' +\n    '{%n' +\n    '  \"hash\": \"%H\",%n' + // commit hash\n    '  \"author\": {%n' +\n    '    \"name\": \"%an\",%n' + // author\n    '    \"email\": \"%ae\"%n' + // email\n    '  },%n' +\n    '  \"date\": \"%aD\",%n' + // date\n    '  \"subject\": \"%s\",%n' + // subject\n    '  \"body\": \"%b\"%n' + // body\n    '}%n' +\n    '--grunt-gitlog-separator--' // separator\n```\n\nThe format for the log output\n\n#### options.number\nType: `Int`\nDefault value: none.\n\nThe number of logs entries to export\n\n#### options.from\nType: `String`\nDefault value: none.\n\nA commit hash, tag, etc to start from.\n\n#### options.to\nType: `String`\nDefault value: none.\n\nA commit hash, tag, etc to end at. Defaults to `'HEAD'` if `from` is specified.\n\n#### options.dateOrder\nType: `Boolean`\nDefault value: none.\n\nWhether to order by date. Defaults to true when `options.after` or `options.before` are specified.\n\n#### options.after\nType: `Date`\nDefault value: none.\n\nA date to start from. Causes `options.dateOrder` to be true\n\n#### options.before\nType: `Date`\nDefault value: none.\n\nA date to stop at. Causes `options.dateOrder` to be true\n\n#### options.noMerges\nType: `Boolean`\nDefault value: true.\n\nWhether or not to include merges in the logs.\n\n## The \"gitapply\" task\n\nApplies a patch (or a series of patches) to your cwd\n\n### Overview\n\nIn your project's Gruntfile, add a section named `gitapply` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  gitapply: {\n    mytarget: {\n      options: {\n        patchFiles: './myFile.patch',\n      }\n    }\n  }\n})\n```\n\n### Options\n\n#### options.patchFiles\ntype: `String`\ndefault value: none.\n\nString (can be a glob), representing the path to the patch files you want to apply\n\n#### options.stat\nType: `Boolean`\nDefault value: none\n\nRather than actually applying the patch, outputs a diffstat to your optional `callback`.\nWill not apply your patch by default - override by setting `options.apply` to true\n\n#### options.numstat\nType: `Boolean`\nDefault value: none\n\nSimilar to `options.stat`, but shows the number of added and deleted lines in decimal notation and the pathname without abbreviation, to make it more machine friendly. For binary files, outputs two - instead of saying 0 0.\nWill not apply your patch by default - override by setting `options.apply` to true\n\n#### options.summary\nType: `Boolean`\nDefault value: none\n\nInstead of applying the patch, output a condensed summary of information obtained from git diff extended headers, such as creations, renames and mode changes.\nWill not apply your patch by default - override by setting `options.apply` to true\n\n#### options.check\nType: `Boolean`\nDefault value: none\n\nInstead of applying the patch, see if the patch is applicable to the current working tree and/or the index file and detects errors.\nWill not apply your patch by default - override by setting `options.apply` to true\n\n#### options.index\ntype: `Boolean`\ndefault value: none\n\nwhen `options.check` is in effect, or when applying the patch (which is the default when none of the options that disables it is in effect), make sure the patch is applicable to what the current index file records. if the file to be patched in the working tree is not up-to-date, it is flagged as an error. this flag also causes the index file to be updated.\n\n#### options.threeway\ntype: `Boolean`\ndefault value: none\n\nWhen the patch does not apply cleanly, fall back on 3-way merge if the patch records the identity of blobs it is supposed to apply to, and we have those blobs available locally, possibly leaving the conflict markers in the files in the working tree for the user to resolve. This option implies `options.index`, and is incompatible with `options.reject` and `options.cached`.\n\n#### options.reverse\ntype: `Boolean`\ndefault value: none\n\nApply the patch in reverse.\n\n#### options.reject\ntype: `Boolean`\ndefault value: none\n\nFor atomicity, git apply by default fails the whole patch and does not touch the working tree when some of the hunks do not apply. This option makes it apply the parts of the patch that are applicable, and leave the rejected hunks in corresponding `*.rej` files.\n\n### options.numStatKeepPathNames\ntype: `Boolean`\ndefault value: none\n\nWhen `options.numstat` has been given, do not munge pathnames, but use a NUL-terminated machine-readable format.\nWithout this option, each pathname output will have TAB, LF, double quotes, and backslash characters replaced with `\\t`, `\\n`, `\\\"`, and `\\\\`, respectively, and the pathname will be enclosed in double quotes if any of those replacements occurred.\n\n### options.removeLeadingSlashes\ntype: `int`\ndefault value: none\n\nRemoves the number of leading slashes from traditional diff paths as you give in the options (e.g. `{p: 10}` means remove 10).\n\n### options.ensureContextMatch\ntype: `int`\ndefault value: none\n\nEnsure at least the number of lines given in the config of surrounding context match before and after each change. When fewer lines of surrounding context exist they all must match. By default no context is ever ignored.\n\n### options.unidiffZero\ntype: `Boolean`\ndefault value: none\n\nBy default, git apply expects that the patch being applied is a unified diff with at least one line of context. This provides good safety measures, but breaks down when applying a diff generated with --unified=0. To bypass these checks use `options.unidiffZero`.\n\n### options.apply\ntype: `Boolean`\ndefault value: none\n\nIf you use any of the options marked \"Turns off apply\" above, git apply reads and outputs the requested information without actually applying the patch. Give this flag after those flags to also apply the patch.\n\n### options.noAdd\ntype: `Boolean`\ndefault value: none\n\nWhen applying a patch, ignore additions made by the patch. This can be used to extract the common part between two files by first running diff on them and applying the result with this option, which would apply the deletion part but not the addition part.\n\n### options.exclude\ntype: `String`\ndefault value: none\n\nDon’t apply changes to files matching the given path pattern. This can be useful when importing patchsets, where you want to exclude certain files or directories.\n\n### options.include\ntype: `String`\ndefault value: none\n\nApply changes to files matching the given path pattern. This can be useful when importing patchsets, where you want to include certain files or directories.\n\n### options.ignoreSpaceChange\ntype: `Boolean`\ndefault value: none\n\nWhen applying a patch, ignore changes in whitespace in context lines if necessary. Context lines will preserve their whitespace, and they will not undergo whitespace fixing regardless of the value of this option. New lines will still be fixed, though.\n\n### options.ignoreWhitespace\ntype: `Boolean`\ndefault value: none\n\nAlias value for `options.ignoreSpaceChang`\n\n### options.whitespace\ntype: `String`\ndefault value: none\n\nWhen applying a patch, detect a new or modified line that has whitespace errors. What are considered whitespace errors is controlled by `core.whitespace` configuration. By default, trailing whitespaces (including lines that solely consist of whitespaces) and a space character that is immediately followed by a tab character inside the initial indent of the line are considered whitespace errors.\n\nBy default, the command outputs warning messages but applies the patch. When git-apply is used for statistics and not applying a patch, it defaults to nowarn.\n\nYou can use different values to control this behavior:\n\n- `nowarn` turns off the trailing whitespace warning.\n- `warn` outputs warnings for a few such errors, but applies the patch as-is (default).\n- `fix` outputs warnings for a few such errors, and applies the patch after fixing them (strip is a synonym --- the tool used to consider only trailing whitespace characters as errors, and the fix involved stripping them, but modern Gits do more).\n- `error` outputs warnings for a few such errors, and refuses to apply the patch.\n- `error-all` is similar to error but shows all errors.\n\nThe output is made available via `options.callback`\n\n### options.inaccurateEOF\ntype: `Boolean`\ndefault value: none\n\nUnder certain circumstances, some versions of diff do not correctly detect a missing new-line at the end of the file. As a result, patches created by such diff programs do not record incomplete lines correctly. This option adds support for applying such patches by working around this bug.\n\n### options.recount\ntype: `Boolean`\ndefault value: none\n\nDo not trust the line counts in the hunk headers, but infer them by inspecting the patch (e.g. after editing the patch without adjusting the hunk headers appropriately).\n\n### options.directory\ntype: `String`\ndefault value: none\n\nPrepend the value you assign to `options.directory` to all filenames. If a `options.removeLeadingSlashes`  also set, it is applied before prepending the new root.\n\nFor example, a patch that talks about updating `a/git-gui.sh` to `b/git-gui.sh` can be applied to the file in the working tree `modules/git-gui/git-gui.sh` by setting `{ directory: \"modules/git-gui\" }`.\n\n### options.unsafePaths\ntype: `Boolean`\ndefault value: none\n\nBy default, a patch that affects outside the working area (either a Git controlled working tree, or the current working directory when \"git apply\" is used as a replacement of GNU patch) is rejected as a mistake (or a mischief).\n\n#### options.callback\ntype: `function`\ndefault value: none.\n\na callback function to call with the log results.\n\n#### options.noWalk\nType: `Boolean`\nDefault value: false.\n\nOnly show the given commits, and do no traverse their ancestors. Has NO effect if `to` or `from` is also specified.\n\n#### options.tags\nType: `Boolean`\nDefault value: false.\n\nOnly list all tagged commits\n\n## The \"gitstatus\" task\n\nFetches the git status, storing the result in a grunt property, and/or calling a callback function with the result.\n\nThe result is a list of objects, each with the following properties:\n\n* `file` - the indicated filename.\n* `code` - a two letter code indicating the status of the file.\n* `descr` - a short description of the status.\n\nIn some cases there is an additional property, `alt_file`, for example if the file has been renamed.\n\nHere's an example result:\n\n```js\n[ { code: 'R ', file: 'from',                descr: 'renamed in index',\n        alt_file: 'to'\n        },\n  { code: '??', file: 'untracked_file.txt',  descr: 'untracked' },\n  { code: 'A ', file: 'new_file.txt',        descr: 'added to index' },\n  { code: 'D ', file: 'deprecated_file.txt', descr: 'deleted from index' },\n  { code: 'AA', file: 'popular_file.txt',    descr: 'unmerged, both added' },\n  { code: '!!', file: 'node_modules/',       descr: 'ignored' }\n]\n```\n\nNote that ignored files will only be included if the `includeIgnored` option is set (see below).\n\nFor full details on all the possible codes, please see the [git status documentation](https://git-scm.com/docs/git-status#_output).\n\n\n\n### Overview\n\nIn your project's Gruntfile, add a section named `gitstatus` to the data object passed into `grunt.initConfig()`.\n\nProperties `prop` and `callback` are both optional, though not using at least one is pointless.\n\n```js\ngrunt.initConfig({\n    gitstatus: {\n        mytarget: {\n            options: {\n                prop:     'gitstatus.mytarget.result',\n                callback: function (result) { ... },\n            },\n        },\n    },\n})\n```\n\n### Options\n\n#### options.prop\nType: `String`\nDefault value: `'gitstatus.\u003ctarget name\u003e.result'`.\n\nThe grunt property in which the result is stored.\n\n#### options.callback\nType: `Function`\nDefault value: none\n\nA callback function to call with the result.\n\n#### options.includeIgnored\nType: `Boolean`\nDefault value: `false`\n\nIf set to true, files ignored by git (in .gitignore for example) are included in the results with a code of \"!!\".\n\n## The \"gitdescribe\" task\n\nThe command finds the most recent tag that is reachable from a commit. If the tag points to the commit, then only the tag is shown. Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object and the abbreviated object name of the most recent commit. The result is a \"human-readable\" object name which can also be used to identify the commit to other git commands.\n\n#### options.all\nType: `Boolean`  \nDefault value: false\n\nInstead of using only the annotated tags, use any ref found in refs/ namespace. This option enables matching any known branch, remote-tracking branch, or lightweight tag.\n\n#### options.tags\nType: `Boolean`  \nDefault value: false\n\nInstead of using only the annotated tags, use any tag found in refs/tags namespace. This option enables matching a lightweight (non-annotated) tag.\n\n#### options.contains\nType: `Boolean`  \nDefault value: false\n\nInstead of finding the tag that predates the commit, find the tag that comes after the commit, and thus contains it. Automatically implies --tags.\n\n#### options.abbrev\nType: `Integer`  \nDefault value: 7\n\nInstead of using the default 7 hexadecimal digits as the abbreviated object name, use \u003cn\u003e digits, or as many digits as needed to form a unique object name. An \u003cn\u003e of 0 will suppress long format, only showing the closest tag.\n\n#### options.candidates\nType: `Integer`  \nDefault value: 10\n\nInstead of considering only the 10 most recent tags as candidates to describe the input commit-ish consider up to \u003cn\u003e candidates. Increasing \u003cn\u003e above 10 will take slightly longer but may produce a more accurate result. An \u003cn\u003e of 0 will cause only exact matches to be output.\n\n#### options.commit-ish\nType: `String`  \nDefault value: \"HEAD\"\n\nCommit-ish object names to describe. Defaults to HEAD if omitted.\n\n#### options.callback\nType: `Function`\nDefault value: none\n\nA callback function to call with the result.\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gitdescribe: {\n        latest: {\n            options: {\n                abbrev: 0,\n                callback: function (result) { ... },\n            }\n        }\n    },\n});\n```\n\nFor full details on all the possible codes, please see the [git describe documentation](https://git-scm.com/docs/git-describe).\n\n## The \"gitremote\" task\n\nManage the set of repositories (\"remotes\") whose branches you track.\n\n#### options.verbose\nType: `Boolean`  \nDefault value: false\n\nBe a little more verbose and show remote url after name.\n\n#### options.add\nType: `Object`  \nDefault value: undefined\n\nAdds a remote named \\\u003cname\u003e for the repository at \\\u003curl\u003e.\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                add: { name: 'upstream', url: 'remote_uri' }\n            }\n        }\n    },\n});\n```\n##### suboptions for add\n\n###### options.t\nType: `String`  \nDefault value: undefined\n\n###### options.f\nType: `Boolean`  \nDefault value: undefined\n\n###### options.tags\nType: `Boolean`  \nDefault value: undefined\n\nSet the --tags or --no-tags flag\n\n###### options.mirror\nType: `String`  \nDefault value: undefined\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                add: { name: 'upstream', url: 'remote_uri' }\n                t: 'branch',\n                f: true,\n                tags: true, //true =\u003e --tags, false =\u003e --no-tags\n                mirror: 'fetch'  //\u003cfetch | push\u003e\n            }\n        }\n    },\n});\n```\n\n\n#### options.rename\nType: `Object`  \nDefault value: undefined\n\nRename the remote named \\\u003cold\u003e to \\\u003cnew\u003e.\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                rename: { old: 'origin', new : 'upstream' }\n            }\n        }\n    },\n});\n```\n\n#### options.remove\nType: `String`  \nDefault value: undefined\n\nRemove the remote named \\\u003cname\u003e.\n\n#### options.sethead\nType: `String`  \nDefault value: undefined\n\nSets or deletes the default branch (i.e. the target of the symbolic-ref refs/remotes/\u003cname\u003e/HEAD) for the named remote.\n\n##### suboptions for sethead\n\n###### options.auto\nType: `Boolean`  \nDefault value: undefined\n\n###### options.delete\nType: `Boolean`  \nDefault value: undefined\n\n###### options.branch\nType: `String`  \nDefault value: undefined\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                sethead: 'name',\n                branch: 'branch'\n            }\n        },\n        mytargat2: {\n            options: {\n                sethead: 'name',\n                auto: true\n             }\n        },\n        mytargat3: {\n            options: {\n                sethead: 'name',\n                delete: true\n            }\n        }\n    },\n});\n```\n\n#### options.setbranches\nType: `Object`  \nDefault value: undefined\n\nChanges the list of branches tracked by the named remote.\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                setbranches: { name: 'name', branch: 'branch' }\n            }\n        }\n    },\n});\n```\n\n##### suboptions for setbranches\n\n###### options.add\nType: `Boolean`  \nDefault value: undefined\n\nInstead of replacing the list of currently tracked branches, adds to that list.\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                setbranches: { name: 'name', branch: 'branch' }\n                add: true\n            }\n        }\n    },\n});\n```\n\n#### options.geturl\nType: `String`  \nDefault value: undefined\n\nRetrieves the URLs for a remote.\n\n##### suboptions for geturl\n\n###### options.push\nType: `Boolean`  \nDefault value: undefined\n\n###### options.all\nType: `Boolean`  \nDefault value: undefined\n\n#### options.seturl\nType: `Object`  \nDefault value: undefined\n\nChanges URLs for the remote.\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                seturl: { name: 'name', url: 'newurl', oldurl: 'oldurl' }\n            }\n        }\n    },\n});\n```\n\n##### suboptions for seturl\n\n###### options.push\nType: `Boolean`  \nDefault value: undefined\n\nPush URLs are manipulated instead of fetch URLs.\n\n###### options.add\nType: `Boolean`  \nDefault value: undefined\n\nInstead of changing existing URLs, new URL is added.\n\n###### options.delete\nType: `Boolean`  \nDefault value: undefined\n\nInstead of changing existing URLs, all URLs matching regex \u003curl\u003e are deleted for remote \u003cname\u003e. Trying to delete all non-push URLs is an error.\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                seturl: { name: 'name', url: 'newurl' },\n                push: true\n            }\n        },\n        mytargat2: {\n            options: {\n                seturl: { name: 'name', url: 'newurl' },\n                add: true\n            }\n        },\n        mytargat3: {\n            options: {\n                seturl: { name: 'name', url: 'newurl' },\n                delete: true\n            }\n        }\n    },\n});\n```\n\n#### options.show\nType: `String`  \nDefault value: undefined\n\nGives some information about the remote \\\u003cname\u003e.\n\n##### suboptions for show\n\n###### options.n\nType: `Boolean`  \nDefault value: undefined\n\nThe remote heads are not queried first with git ls-remote \u003cname\u003e; cached information is used instead.\n\n#### options.prune\nType: `String`  \nDefault value: undefined\n\nDeletes stale references associated with \\\u003cname\u003e.\n\n#### options.update\nType: `Array`  \nDefault value: undefined\n\nFetch updates for remotes or remote groups in the repository as defined by remotes.\\\u003cgroup\u003e.\n\nExample:\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytargat: {\n            options: {\n                update: ['origin', 'upstream']\n            }\n        }\n    },\n});\n```\n\n##### suboptions for update\n\n###### options.prune\nType: `Boolean`  \nDefault value: undefined\n\nRun pruning against all the remotes that are updated.\n\n#### options.callback\nType: `Function`\nDefault value: none\n\nA callback function to call with the result.\n\n### Usage Examples\n\n```js\ngrunt.initConfig({\n    gitremote: {\n        mytarget: {\n            options: {\n                geturl: 'origin',\n                callback: function (result) { ... },\n            }\n        }\n    },\n});\n```\n\nFor full details on all the possible codes, please see the [git remote documentation](https://git-scm.com/docs/git-remote).\n\n## contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubenv%2Fgrunt-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubenv%2Fgrunt-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubenv%2Fgrunt-git/lists"}