{"id":15386631,"url":"https://github.com/christianmurphy/file-util-git-history","last_synced_at":"2025-04-15T20:04:13.362Z","repository":{"id":30457186,"uuid":"124986023","full_name":"ChristianMurphy/file-util-git-history","owner":"ChristianMurphy","description":"Get a file's git history","archived":false,"fork":false,"pushed_at":"2024-10-29T15:15:18.000Z","size":522,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T20:02:42.912Z","etag":null,"topics":["file","git","history","javascript","nodejs","source-control","utility"],"latest_commit_sha":null,"homepage":"","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/ChristianMurphy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-13T03:20:03.000Z","updated_at":"2021-08-11T03:17:53.000Z","dependencies_parsed_at":"2023-01-14T16:59:56.708Z","dependency_job_id":"226852e3-76a8-441b-ac09-97cd584c8636","html_url":"https://github.com/ChristianMurphy/file-util-git-history","commit_stats":{"total_commits":80,"total_committers":5,"mean_commits":16.0,"dds":0.725,"last_synced_commit":"967984789f51b41045820430d4078b3e9c33a7b4"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Ffile-util-git-history","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Ffile-util-git-history/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Ffile-util-git-history/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristianMurphy%2Ffile-util-git-history/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristianMurphy","download_url":"https://codeload.github.com/ChristianMurphy/file-util-git-history/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249145291,"owners_count":21219966,"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":["file","git","history","javascript","nodejs","source-control","utility"],"created_at":"2024-10-01T14:49:59.717Z","updated_at":"2025-04-15T20:04:13.341Z","avatar_url":"https://github.com/ChristianMurphy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# file-util-git-history\n\n[![NPM Version](https://img.shields.io/npm/v/file-util-git-history.svg)](https://www.npmjs.com/package/file-util-git-history)\n[![CI](https://github.com/ChristianMurphy/file-util-git-history/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/ChristianMurphy/file-util-git-history/actions/workflows/main.yml)\n\n## Installation\n\n```shell\n# npm installation\nnpm install file-util-git-history\n\n# yarn installation\nyarn add file-util-git-history\n```\n\n## Usage\n\n```javascript\nconst { gitHistory } = require(\"file-util-git-history\");\n\n// get history for current file\ngitHistory(__filename)\n  // get the SHA hash for each commit\n  .then((history) =\u003e history.map(({ commit }) =\u003e commit.sha()))\n  // print out the SHAs\n  .then(console.log);\n```\n\ngit history can accept two parameters:\n\n- `{string} filePath` path to file\n- `{Object} [options]` optional configuration\n  - `{string} [gitPath]` - optional predetermined git folder to get history from\n\nwill return a promise that resolves to a list of `{status, commit}`.\nWhere `status` is a git status code, and `commit` is a [nodegit `Commit` class](http://www.nodegit.org/api/commit/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianmurphy%2Ffile-util-git-history","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristianmurphy%2Ffile-util-git-history","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristianmurphy%2Ffile-util-git-history/lists"}