{"id":21188413,"url":"https://github.com/drsensor/fluent-git","last_synced_at":"2025-07-10T02:31:28.023Z","repository":{"id":40294391,"uuid":"148944409","full_name":"DrSensor/fluent-git","owner":"DrSensor","description":"A JS/TS library to use git fluently 😎 (just an experiment)","archived":false,"fork":false,"pushed_at":"2023-01-04T12:52:34.000Z","size":1459,"stargazers_count":4,"open_issues_count":23,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-11T16:22:33.772Z","etag":null,"topics":["git","my-amusement"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/DrSensor.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-15T22:23:22.000Z","updated_at":"2021-05-22T08:00:32.000Z","dependencies_parsed_at":"2023-02-02T13:02:17.035Z","dependency_job_id":null,"html_url":"https://github.com/DrSensor/fluent-git","commit_stats":null,"previous_names":["drsensor/git-notes"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrSensor%2Ffluent-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrSensor%2Ffluent-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrSensor%2Ffluent-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrSensor%2Ffluent-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrSensor","download_url":"https://codeload.github.com/DrSensor/fluent-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225613152,"owners_count":17496774,"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","my-amusement"],"created_at":"2024-11-20T18:44:41.858Z","updated_at":"2024-11-20T18:44:43.583Z","avatar_url":"https://github.com/DrSensor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fluent Git\n\n[![npm][npm]][npm-url]\n[![node][node]][node-url]\n[![size][size]][size-url]\n[![npm][npm-download]][npm-url]\n[![deps][deps]][deps-url]\n[![tests][tests]][tests-url]\n[![cover][cover]][cover-url]\n\n\u003cimg align=\"right\" src=\"./logo.svg\" height=\"300\"/\u003e\n\nFeatures:\n\n- [x] git-notes basic subcommand (add, remove, show, etc) with handler:\n  - [x] atCommit()\n  - [x] atFile()\n  - [x] atFolder()\n  - [ ] atSubmodule()\n  - [ ] atTag()\n- [ ] git-log...\n  - [ ] search and list notes\n  - [ ] search and list commit\n- [ ] git-checkout...\n- [ ] git-hooks...\n\n### Getting Started\n\nTo begin, you'll need to install `fluent-git`:\n\n```console\nnpm install fluent-git\n```\n\nor if you use yarn\n\n```console\nyarn add fluent-git\n```\n\n## git-notes \u003csup\u003e\u003csup\u003e[[man](https://git-scm.com/docs/git-notes)]\u003c/sup\u003e\u003csup\u003e\n\n\u003csup\u003e\u003csup\u003etl;dr -- see example on each [operation](#operation) or [handler](#handler)\u003c/sup\u003e\u003c/sup\u003e\n\n```ts\nimport { notes } from \"fluent-git\";\n```\n\n`notes([text|][,options])` is a function that take 2 arguments and both of them are optional:\n\n- `text` - `string` that can be either SHA-1, `HEAD`, or notes.\n- `options` - `string` that point to [--ref][]. Or `Object` which represent the [Options](#options).\n\n\u003cdetails\u003e\n\u003csummary\u003eWhen \u003ccode\u003etext\u003c/code\u003e is \u003ccode\u003eundefined\u003c/code\u003e\u003c/summary\u003e\n\n```ts\nnotes()[handler](...)[operation](...)\n// or\nnotes({\n  ...Options\n})[handler](...)[operation](...)\n\n// in case you need autocompletion in typescript\nconst $notes = notes() as NoteUse.Manually\n```\n\n- Available operation: `add`, `overwriteWith`, `copyFrom`, `append`, `remove`, `show`\n- Available handler: `at`, `atCommit`, `atFile`, `atFolder`\n  \u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eWhen \u003ccode\u003etext\u003c/code\u003e is a notes (not identified as string \u003ccode\u003eHEAD\u003c/code\u003e or hash)\u003c/summary\u003e\n\n```ts\nnotes('some long notes')[operation][handler](...)\n\n// in case you need autocompletion in typescript\nconst $notes = notes('some long notes') as NoteUse.Text\n```\n\n- Available operation: `add`, `overwrite`, `copy`, `append`\n- Available handler: `at`, `atCommit`, `atFile`, `atFolder`\n  \u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eWhen \u003ccode\u003etext\u003c/code\u003e is a hash string\u003c/summary\u003e\n\n```ts\nconst sha = '69f3c3d' // or 'HEAD'\nnotes(sha)[operation](...)\n\n// in case you need autocompletion in typescript\nconst $notes = notes('69f3c3d') as NoteUse.Hash\n```\n\n- Available operation: `add`, `overwriteWith`, `copyFrom`, `append`, `remove`, `show`\n- Available handler: `at`, `atCommit`, `atFile`, `atFolder`\n  \u003c/details\u003e\n\n### Operation\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eadd\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\nAdd notes on specific git-object (commit, blob/file, tree/folder, submodule, or tag)\n\n- Arguments: `string`\n- Expected value: any string that represent notes but it **can not** be hash string or word `HEAD`\n- Return: ~\n\nExample\n\n```js\nnotes().at(sha).add(\"some long notes\");\nnotes(\"some long notes\").add.at(sha);\nnotes(\"af23339\").add(\"some long notes\");\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eremove\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\nRemove notes on specific git-object (commit, blob/file, tree/folder, submodule, or tag)\n\n- Arguments: ~\n- Expected value: ~\n- Return: ~\n\nExample\n\n```js\nnotes().at(sha).remove();\nnotes(\"af23339\").remove();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eshow\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\nRead notes on specific git-object (commit, blob/file, tree/folder, submodule, or tag)\n\n- Arguments: ~\n- Expected value: ~\n- Return: `string`\n\nExample\n\n```js\nmynotes1 = notes().at(sha).show();\nmynotes2 = notes(\"af23339\").show();\nconsole.log(String(mynotes1 + \"\\n\" + mynotes2));\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eappend\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\nAppend notes on specific git-object (commit, blob/file, tree/folder, submodule, or tag) that has/hasn't a notes.\n\n- Arguments: `string`\n- Expected value: any string that represent notes but it **can not** be hash string or word `HEAD`\n- Return: ~\n\nExample\n\n```js\nnotes().at(sha).append(\"some long notes\");\nnotes(\"some long notes\").append.at(sha);\nnotes(\"af23339\").append(\"some long notes\");\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eoverwrite\u003c/code\u003e\u003c/b\u003e or \u003cb\u003e\u003ccode\u003eoverwriteWith\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\nOverwrite notes on specific git-object (commit, blob/file, tree/folder, submodule, or tag). The source can be notes on another git-object or provided manually\n\n- Arguments: `string`\n- Expected value: any string that represent notes, hash string, or word `HEAD`\n- Return: ~\n\nExample\n\n```js\nconst sourceNotes = \"HEAD\";\nnotes().at(sha).overwriteWith(\"some long notes\");\nnotes().at(sha).overwriteWith(sourceNotes);\nnotes(\"some long notes\").overwrite.at(sha);\nnotes(\"af23339\").overwriteWith(\"some long notes\");\nnotes(\"af23339\").overwriteWith(sourceNotes);\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003ecopy\u003c/code\u003e\u003c/b\u003e or \u003cb\u003e\u003ccode\u003ecopyFrom\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\nCopy notes from git-object (commit, blob/file, tree/folder, submodule, or tag) to another git-object.\n\n- Arguments: `string`\n- Expected value: must be hash string or word `HEAD`\n- Return: ~\n\nExample\n\n```js\nnotes().at(sha).copyFrom(\"b0279ab\");\nnotes(\"some long notes\").copy.at(\"af23339\"); // same as `add` operation\nnotes(\"af23339\").copyFrom(\"b0279ab\");\n```\n\n\u003c/details\u003e\n\n### Handler\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eat(sha)\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\n\n- Arguments: `string`\n- Expected value: must be hash string or word `HEAD`\n\nExample\n\n```js\nnotes().at(\"af23339\").show();\nnotes().at(\"HEAD\").show();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eatCommit(message)\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\n\n- Arguments: `string`\n- Expected value: must be valid commit message\n\nExample\n\n```js\nnotes().atCommit(\"Initial commit\").show();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eatFile(filename, commit)\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\n\n- Arguments:\n  - filename - `string`\n  - commit - `string`\n- Expected value:\n  - commit - commit message or commit-id (SHA-1)\n  - filename - a valid filename of that specific commit. Can include relative path (without `./`) but not with absolute path\n\nExample\n\n```js\nnotes().atFile(\"README.md\", \"Initial commit\").show();\nnotes().atFile(\"README.md\", \"af23339\").show();\nnotes().atFile(\"packages/mod1/README.md\", \"HEAD\").show();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003e\u003ccode\u003eatFolder(folder, commit)\u003c/code\u003e\u003c/b\u003e\u003c/summary\u003e\n\n- Arguments:\n  - folder - `string`\n  - commit - `string`\n- Expected value:\n  - commit - commit message or commit-id (SHA-1)\n  - folder - a valid folder of that specific commit. Must be relative path without prefix `./` and suffix '/'\n\nExample\n\n```js\nnotes().atFolder(\"src\", \"Initial commit\").show();\nnotes().atFolder(\"src\", \"af23339\").show();\nnotes().atFolder(\"packages/mod1/src\", \"HEAD\").show();\n```\n\n\u003c/details\u003e\n\n### Options\n\nThe options are the combination of [execa options][] plus this:\n\n```ts\n{\n  ref: String; // represent flag --ref in git-notes\n}\n```\n\n[execa options]: https://github.com/sindresorhus/execa#options\n[--ref]: https://git-scm.com/docs/git-notes#git-notes---refltrefgt\n\n## Who use this?\n\n- [guc-desktop](https://github.com/g-u-c/guc-desktop)\n- [add yours 😉]\n\n## Contributing\n\n- [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for how you can make contribution\n- [HACKING.md](./.github/HACKING.md) for technical details\n\n---\n\n## License\n\n[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FDrSensor%2Ffluent-git.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FDrSensor%2Ffluent-git?ref=badge_large)\n\n[npm]: https://img.shields.io/npm/v/fluent-git.svg\n[npm-url]: https://npmjs.com/package/fluent-git\n[npm-download]: https://img.shields.io/npm/dm/fluent-git.svg\n[node]: https://img.shields.io/node/v/fluent-git.svg\n[node-url]: https://nodejs.org\n[deps]: https://david-dm.org/DrSensor/fluent-git.svg\n[deps-url]: https://david-dm.org/DrSensor/fluent-git\n[tests]: https://circleci.com/gh/DrSensor/fluent-git/tree/master.svg?style=shield\n[tests-url]: https://circleci.com/gh/DrSensor/fluent-git/tree/master\n[cover]: https://codecov.io/gh/DrSensor/fluent-git/branch/master/graph/badge.svg\n[cover-url]: https://codecov.io/gh/DrSensor/fluent-git/branch/master\n[size]: https://packagephobia.now.sh/badge?p=fluent-git\n[size-url]: https://packagephobia.now.sh/result?p=fluent-git\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrsensor%2Ffluent-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrsensor%2Ffluent-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrsensor%2Ffluent-git/lists"}