{"id":19071920,"url":"https://github.com/cyansalt/git9","last_synced_at":"2026-04-10T09:02:16.998Z","repository":{"id":242987774,"uuid":"811139187","full_name":"CyanSalt/git9","owner":"CyanSalt","description":"Utilities for Git","archived":false,"fork":false,"pushed_at":"2025-11-28T02:29:39.000Z","size":309,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-29T08:46:01.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CyanSalt.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-06T02:36:19.000Z","updated_at":"2025-11-28T02:29:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"a2d0e11c-bdca-497e-ae88-ba4b9a31882b","html_url":"https://github.com/CyanSalt/git9","commit_stats":null,"previous_names":["cyansalt/git9"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/CyanSalt/git9","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fgit9","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fgit9/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fgit9/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fgit9/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyanSalt","download_url":"https://codeload.github.com/CyanSalt/git9/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyanSalt%2Fgit9/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31635969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-09T01:32:39.153Z","updated_at":"2026-04-10T09:02:16.992Z","avatar_url":"https://github.com/CyanSalt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git9\n\n[![npm](https://img.shields.io/npm/v/git9.svg)](https://www.npmjs.com/package/git9)\n\n\u003cimg src=\"https://cdn.jsdelivr.net/gh/CyanSalt/git9@main/docs/icon.svg\" width=\"64\" height=\"64\"\u003e\n\nUtilities (How many letters?) for Git.\n\n## Installation\n\n```shell\nnpm install --save git9\n```\n\n## Usage\n\n```js\nimport {\n  getCommit,\n  getCurrentCommit,\n  hasCommit,\n  isMerging,\n  hasConflicts,\n  getBranch,\n  getCurrentBranch,\n  getRootDirectory,\n  getConfig,\n  getRemoteURL,\n  getRemoteCommit,\n  getDifferences,\n  getChangedFiles,\n  downloadFile,\n} from 'git9'\n```\n\nThis module is implemented with [quansync](https://github.com/quansync-dev/quansync), so all of these functions have both asynchronous and synchronous versions, and even _uncollapsed quantum_ versions. Therefore, you can use them in any of the following ways:\n\n```ts\n// 1. Simple asynchronous version\nconst commit = await getCommit('HEAD')\n\n// 2. Explicit asynchronous version\nconst commit = await getCommit.async('HEAD')\n\n// 3. Synchronous version\nconst commit = getCommit.sync('HEAD')\n\n// 4. Uncollapsed quantum version\nconst fn = quansync(function* () {\n  const commit = yield* getCommit('HEAD')\n})\n```\n\nBy default, all functions execute based on `process.cwd()`. If you want to execute based on a different directory, you can use `this` binding as follows:\n\n```ts\n// Use any of the following versions\nconst commit = await getCommit.call({ cwd: anotherPath }, 'HEAD')\n\nconst commit = await getCommit.async.call({ cwd: anotherPath }, 'HEAD')\n\nconst commit = getCommit.sync.call({ cwd: anotherPath }, 'HEAD')\n```\n\n### `getCommit`\n\n```ts\nfunction getCommit(committish: string): Promise\u003cstring\u003e\n```\n\nGet commit hash with a commit-ish string.\n\n### `getCurrentCommit`\n\n```ts\nfunction getCurrentCommit(): Promise\u003cstring\u003e\n```\n\nGet commit hash of the current branch.\n\n### `hasCommit`\n\n```ts\nfunction hasCommit(committish: string): Promise\u003cboolean\u003e\n```\n\nCheck whether a specified branch or pointer exists.\n\n### `isMerging`\n\n```ts\nfunction isMerging(): Promise\u003cboolean\u003e\n```\n\nCheck whether the working repository is in the merging state. Equivalent to `hasCommit('MERGE_HEAD')`.\n\n### `hasConflicts`\n\n```ts\nfunction hasConflicts(subpath?: string): Promise\u003cboolean\u003e\n```\n\nCheck whether the working repository has conflicts.\n\n### `getBranch`\n\n```ts\nfunction getBranch(committish: string): Promise\u003cstring\u003e\n```\n\nGet the branch name of a commit-ish.\n\n### `getCurrentBranch`\n\n```ts\nfunction getCurrentBranch(): Promise\u003cstring\u003e\n```\n\nGet the current branch name. Equivalent to `getBranch('HEAD')`.\n\n### `getRootDirectory`\n\n```ts\nfunction getRootDirectory(): Promise\u003cstring\u003e\n```\n\nGet the root directory of the repository.\n\n### `getConfig`\n\n```ts\nfunction getConfig(config: string): Promise\u003cstring\u003e\n```\n\nGet specified config value of the repository.\n\n### `getRemoteURL`\n\n```ts\nfunction getRemoteURL(name: string): Promise\u003cstring\u003e\n```\n\nGet remote repository URL with specified name.\n\n### `getRemoteCommit`\n\n```ts\nfunction getRemoteCommit(url: string, committish: string): Promise\u003cstring\u003e\n```\n\nGet commit hash with a commit-ish string from remote.\n\n### `getDifferences`\n\n```ts\nfunction getDifferences(committish: string): Promise\u003c{\n  name: string;\n  status: string;\n}[]\u003e\n```\n\nGet differences between the current branch and the specified commit-ish.\n\n\u003e Possible status letters are:\n\u003e - A: addition of a file\n\u003e - C: copy of a file into a new one\n\u003e - D: deletion of a file\n\u003e - M: modification of the contents or mode of a file\n\u003e - R: renaming of a file\n\u003e - T: change in the type of the file (regular file, symbolic link or submodule)\n\u003e - U: file is unmerged (you must complete the merge before it can be committed)\n\u003e - X: \"unknown\" change type (most probably a bug, please report it)\n\nSee [git-diff](https://git-scm.com/docs/git-diff).\n\n### `getChangedFiles`\n\n```ts\nfunction getChangedFiles(committish: string): Promise\u003cstring[]\u003e\n```\n\nGet changed files in current branch from the specified commit-ish.\n\n### `downloadFile`\n\n```ts\nfunction downloadFile(url: string, committish: string, file: string): Promise\u003cstring\u003e\n```\n\nDownload specified file with a commit-ish string from remote using git-archive protocol.\n\n\u003e [!NOTE]\n\u003e GitHub does not support git-archive protocol.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyansalt%2Fgit9","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyansalt%2Fgit9","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyansalt%2Fgit9/lists"}