{"id":15732449,"url":"https://github.com/jonschlinkert/is-dirty","last_synced_at":"2025-03-13T04:31:14.192Z","repository":{"id":57277089,"uuid":"53639597","full_name":"jonschlinkert/is-dirty","owner":"jonschlinkert","description":"Returns true if a git repository has staged, unstaged or untracked changes.","archived":false,"fork":false,"pushed_at":"2016-07-17T18:12:48.000Z","size":10,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T18:24:41.108Z","etag":null,"topics":["git","head","staged","unstaged"],"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/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-03-11T04:30:43.000Z","updated_at":"2021-04-12T22:34:52.000Z","dependencies_parsed_at":"2022-09-18T06:57:07.675Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/is-dirty","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fis-dirty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fis-dirty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fis-dirty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fis-dirty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/is-dirty/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243341406,"owners_count":20275866,"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":["git","head","staged","unstaged"],"created_at":"2024-10-04T00:20:26.588Z","updated_at":"2025-03-13T04:31:13.732Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# is-dirty [![NPM version](https://img.shields.io/npm/v/is-dirty.svg?style=flat)](https://www.npmjs.com/package/is-dirty) [![NPM downloads](https://img.shields.io/npm/dm/is-dirty.svg?style=flat)](https://npmjs.org/package/is-dirty) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-dirty.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-dirty)\n\nReturns false if a git repository has no staged, unstaged or untracked changes.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save is-dirty\n```\n\n## API\n\n```js\nvar isDirty = require('is-dirty');\n\nisDirty(directory[, globPatterns], callback);\n```\n\n**Params**\n\n* `directory` **{String}**: a directory that contains a `.git` folder\n* `globPatterns` **{String|Array}**: optionally pass one or more glob patterns to use for matching any uncommitted files. This is useful if you only want to know if specific files have not been committed.\n* `callback`: **{Function}**: function to call after the git status is returned\n\n### Usage\n\n```js\nisDirty(process.cwd(), function(err, status) {\n  console.log(status);\n});\n```\n\n* **err**: if a `.git` directory does not exist\n* **status**: if `.git` directory exists, and there are no staged, unstaged or untracked changes, `status`will be undefined. Otherwise `status` is an object with `staged`, `unstaged` or `untracked` changes, and `matches` if glob patterns are passed.\n\n### Example\n\nGiven you have a project with the following `staged` files:\n\n```\n.\n├── a.txt\n├── b.txt\n├── c.txt\n├── d.txt\n└── e.txt\n```\n\nThe following:\n\n```js\nisDirty(process.cwd(), function(err, status) {\n  if (err) return console.log(err);\n  console.log(status);\n});\n```\n\nWould result in:\n\n```js\n{ staged:\n   [ { file: 'a.txt', status: 'new file' },\n     { file: 'b.txt', status: 'new file' },\n     { file: 'c.txt', status: 'new file' },\n     { file: 'd.txt', status: 'new file' },\n     { file: 'e.txt', status: 'new file' } ],\n  unstaged: [],\n  untracked: [],\n  matches: [] }\n```\n\n**Matches**\n\nPass a glob or array of globs as the second argument to return an array of matching files on the `status.matches` array:\n\n```js\nisDirty(process.cwd(), ['{a,c}.txt'], function(err, status) {\n  if (err) return console.log(err);\n  console.log(status);\n});\n```\n\nWould result in:\n\n```js\n{ staged:\n   [ { file: 'a.txt', status: 'new file' },\n     { file: 'b.txt', status: 'new file' },\n     { file: 'c.txt', status: 'new file' },\n     { file: 'd.txt', status: 'new file' },\n     { file: 'e.txt', status: 'new file' } ],\n  unstaged: [],\n  untracked: [],\n  matches: [ 'a.txt', 'c.txt' ] }\n```\n\n## About\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Building docs\n\n_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_\n\nTo generate the readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install -g verb verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT license](https://github.com/jonschlinkert/is-dirty/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 17, 2016._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fis-dirty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fis-dirty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fis-dirty/lists"}