{"id":17929816,"url":"https://github.com/samypesse/gitkit-js","last_synced_at":"2025-04-05T19:13:30.318Z","repository":{"id":48913422,"uuid":"48116762","full_name":"SamyPesse/gitkit-js","owner":"SamyPesse","description":"Pure javascript implementation of Git (Node.js and Browser)","archived":false,"fork":false,"pushed_at":"2018-01-26T10:35:37.000Z","size":7747,"stargazers_count":604,"open_issues_count":13,"forks_count":35,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-04-14T23:08:28.165Z","etag":null,"topics":["cli","git","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SamyPesse.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.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":"2015-12-16T14:57:40.000Z","updated_at":"2024-01-04T16:02:25.000Z","dependencies_parsed_at":"2022-09-23T23:51:39.147Z","dependency_job_id":null,"html_url":"https://github.com/SamyPesse/gitkit-js","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/SamyPesse%2Fgitkit-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamyPesse%2Fgitkit-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamyPesse%2Fgitkit-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SamyPesse%2Fgitkit-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SamyPesse","download_url":"https://codeload.github.com/SamyPesse/gitkit-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386265,"owners_count":20930619,"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":["cli","git","javascript"],"created_at":"2024-10-28T21:10:38.077Z","updated_at":"2025-04-05T19:13:30.280Z","avatar_url":"https://github.com/SamyPesse.png","language":"JavaScript","readme":"# GitKit.js\n\n[![NPM version](https://badge.fury.io/js/gitkit.svg)](http://badge.fury.io/js/gitkit)\n[![Linux Build Status](https://travis-ci.org/SamyPesse/gitkit-js.svg?branch=master)](https://travis-ci.org/SamyPesse/gitkit-js)\n[![Windows Build status](https://ci.appveyor.com/api/projects/status/63nlflxcwmb2pue6?svg=true)](https://ci.appveyor.com/project/SamyPesse/gitkit-js)\n\nPure JavaScript implementation of Git backed by immutable models and promises.\n\nThe goal is to provide both a low and high level API for manipulating Git repositories: read files, commit changes, edit working index, clone, push, fetch, etc.\n\nThis library can work both in the browser and Node.js.\n\n## Installation\n\n```\n$ npm install gitkit\n```\n\n## Usage\n\n#### API Basics\n\nState of the Git repository is represented as a single immutable `Repository` object. Read and write access to the repository is done using a `FS` driver, the implementation of the fs depends on the plaftrom (`NativeFS` for Node.js/Native, `LocalStorageFS` or `MemoryFS` for the browser).\n\n```js\nvar GitKit = require('gitkit');\nvar NativeFS = require('gitkit/lib/fs/native');\n\n// Prepare the filesystem\nvar fs = NativeFS(process.cwd());\n\n// Create a repository instance\nvar repo = GitKit.Repository.createWithFS(fs, isBare);\n```\n\n##### Clone a remote repository\n\n```js\n// Create a transport instance for the GitHub repository\nvar transport = new GitKit.HTTPTransport('https://github.com/GitbookIO/gitbook.git');\n\nGitKit.TransferUtils.clone(repo, transport)\n.then(function(newRepo) {\n    // Clone succeed!\n}, function(err) {\n    // Clone failed\n})\n```\n\n##### List branches\n\n`GitKit.BranchUtils.list` returns a promise listing branches as a list of strings.\n\n```js\nGitKit.BranchUtils.list(repo)\n    .then(function(branches) { ... })\n```\n\n##### Get current branch\n\n`GitKit.BranchUtils.getCurrent` returns a promise resolved with the name of the current active branch.\n\n```js\nGitKit.BranchUtils.getCurrent(repo)\n    .then(function(branch) { ... })\n```\n\n##### List files in repository\n\n`GitKit.WorkingIndex` provides a set of methods to work with the working index.\n\n```js\nGitKit.WorkingIndex.readFromRepo(repo)\n    .then(function(workingIndex) {\n        var entries = workingIndex.getEntries();\n    });\n```\n\n##### List changes not staged for commit\n\n`GitKit.ChangesUtils` provides a set of methods to work with pending changes.\n\n```js\nGitKit.ChangesUtils.list(repo)\n    .then(function(changes) { ... });\n```\n\n##### Commit changes\n\n```js\nvar author = GitKit.Person.create('Bob', 'bob@gmail.com');\nvar message = 'My First commit';\n\nGitKit.CommitUtils.createForChanges(repo, author, message, changes)\n    .then(function(newRepo) { ... });\n```\n\n##### More example and documentation coming soon!\n\nI'll publish a better documentation for this library soon.\n\n## Thanks\n\nTo the people pointing me in the right directions like:\n\n- [Stefan Saasen](http://stefan.saasen.me/articles/git-clone-in-haskell-from-the-bottom-up/)\n- [Chris Dickinson](https://github.com/chrisdickinson)\n\n## License\n\n`GitKit.js` is [Apache-licensed](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamypesse%2Fgitkit-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamypesse%2Fgitkit-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamypesse%2Fgitkit-js/lists"}