{"id":23058639,"url":"https://github.com/suhdev/git-data-extractor","last_synced_at":"2025-07-30T23:15:45.340Z","repository":{"id":32441293,"uuid":"36019532","full_name":"suhdev/git-data-extractor","owner":"suhdev","description":"A node module to extract information from git repositories. ","archived":false,"fork":false,"pushed_at":"2015-05-21T22:35:02.000Z","size":124,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T11:06:45.061Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suhdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-21T15:03:25.000Z","updated_at":"2015-05-21T15:45:45.000Z","dependencies_parsed_at":"2022-07-22T08:22:07.693Z","dependency_job_id":null,"html_url":"https://github.com/suhdev/git-data-extractor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fgit-data-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fgit-data-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fgit-data-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhdev%2Fgit-data-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhdev","download_url":"https://codeload.github.com/suhdev/git-data-extractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246944383,"owners_count":20858772,"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":[],"created_at":"2024-12-16T02:16:53.380Z","updated_at":"2025-04-03T06:18:22.173Z","avatar_url":"https://github.com/suhdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-data-extractor\n\nA node module to extract information from git repositories. \n\n## Installation \n\n### Using NPM\n\n```sh\n\tnpm install git-data-extractor --save-dev \n```\n\n### Clone git repository \n\n```sh\n\tgit clone https://github.com/suhdev/git-data-extractor.git\n```\n\n## Usage\n\n```javascript\n\nvar Git = require('git-data-extractor').Git;\n\nvar defaults = {\n\ttagMapper:function(tag){\n\t\tvar m = tag[2].match(/v[0-9][^ \\/]+[0-9]$/gm),\n\t\t\tversion;\n\t\tif (m \u0026\u0026 m.length \u003e 0){\n\t\t\ttry{\n\t\t\t\tversion = semver.parse(m[0]);\n\t\t\t}catch(e){\n\n\t\t\t}finally{\n\t\t\t\tif (!version){\n\t\t\t\t\tversion = {};\n\t\t\t\t}\n\t\t\t}\n\t\t\tversion.shortSha = tag[0];\n\t\t\tversion.longSha = tag[1];\n\t\t\treturn version;\n\t\t}else {\n\t\t\tnull;\n\t\t}\n\t},\n\ttagTransformer:function(version){\n\t\treturn version;\n\t},\n\tlineMapper:function(line){\n\t\treturn [line.substr(0,7),line.substr(0,40),line];\n\t},\n\ttagComparator:semver.compare,\n\tlineRegex:/[a-f0-9]{40}[ \\t]+.*v[0-9][^ \\/]*[0-9]$/gm,\n\tversionRegex:/v[0-9][^ \\/]+[0-9]$/gm,\n\tgitUrl:null,\n\tgitRepositoryPath:null,\n\tpackageSrc:path.join(path.dirname(require.main.filename),'package.json')\n};\n\nvar git = new Git(defaults);\n\n//gets the details for the repository set in the configuration \ngit.getTags(); \n\n//to get the tags for a given repository\ngit.getTags(__dirname); \n\n//to get the tags and versions for a remote repository  \ngit.getTags('http://github.com/example/repo');\n\n//to get commits summary for the current repository (set in the configuration)\ngit.getCommits() \n\n//to get commits summary for a given repository \ngit.getCommits(__dirname); \n\n//to get repository info from URL \ngit.getGitRepoInfoFromUrl(url); \n\n```\n\n\n## Notes\n1. The module uses [semantic versionsing](http://semver.org/) to extract the versions from git. This can be overriden through the configuration settings. \n\n\n\n---\nSuhail Abood \u0026copy; 2015\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Fgit-data-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhdev%2Fgit-data-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhdev%2Fgit-data-extractor/lists"}