{"id":26675603,"url":"https://github.com/linkdata/gitsemver","last_synced_at":"2026-03-04T13:00:44.195Z","repository":{"id":276274408,"uuid":"928751271","full_name":"linkdata/gitsemver","owner":"linkdata","description":"Build a semver compliant version string for a git repository","archived":false,"fork":false,"pushed_at":"2026-03-03T13:41:43.000Z","size":99,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-03T13:41:56.245Z","etag":null,"topics":["git","git-semver","git-tag","go","golang","semver"],"latest_commit_sha":null,"homepage":"","language":"Go","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/linkdata.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-07T07:06:19.000Z","updated_at":"2026-03-03T13:41:47.000Z","dependencies_parsed_at":"2025-08-21T08:14:16.706Z","dependency_job_id":"061dd5c8-d796-4c52-a316-dda3f21ff779","html_url":"https://github.com/linkdata/gitsemver","commit_stats":null,"previous_names":["linkdata/gitsemver"],"tags_count":145,"template":false,"template_full_name":null,"purl":"pkg:github/linkdata/gitsemver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdata%2Fgitsemver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdata%2Fgitsemver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdata%2Fgitsemver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdata%2Fgitsemver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkdata","download_url":"https://codeload.github.com/linkdata/gitsemver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkdata%2Fgitsemver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30081043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T12:28:08.313Z","status":"ssl_error","status_checked_at":"2026-03-04T12:27:28.210Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["git","git-semver","git-tag","go","golang","semver"],"created_at":"2025-03-26T03:18:52.094Z","updated_at":"2026-03-04T13:00:44.177Z","avatar_url":"https://github.com/linkdata.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![build](https://github.com/linkdata/gitsemver/actions/workflows/build.yml/badge.svg)](https://github.com/linkdata/gitsemver/actions/workflows/build.yml)\n[![coverage](https://github.com/linkdata/gitsemver/blob/coverage/main/badge.svg)](https://html-preview.github.io/?url=https://github.com/linkdata/gitsemver/blob/coverage/main/report.html)\n[![goreport](https://goreportcard.com/badge/github.com/linkdata/gitsemver)](https://goreportcard.com/report/github.com/linkdata/gitsemver)\n[![Docs](https://godoc.org/github.com/linkdata/gitsemver?status.svg)](https://godoc.org/github.com/linkdata/gitsemver)\n\n# gitsemver\n\nBuild a SemVer-inspired version string for a git repository.\n\nUsing tree hashes it returns the latest matching semver tag. If no tree hash\nmatch exactly, it falls back to the latest semver tag reachable from the\ncurrent HEAD.\n\nIf the match is not exact or the current branch is not the default branch\nor a protected branch (`CI_COMMIT_REF_PROTECTED` or `GITHUB_REF_PROTECTED` are set), \nit creates a work-in-progress semver string like `v0.1.2-myfeature.123`.\n\nSupports raw git repositories as well as GitLab and GitHub builders.\n\n### Scope and limitations\n\n`gitsemver` is a CLI-first tool, one process run per repository.\n\nTag matching is intentionally relaxed: `vMAJOR`, `vMAJOR.MINOR`, and\n`vMAJOR.MINOR.PATCH` (and the same forms without `v`) are all accepted and\npreserved in output. If you require strict SemVer 2.0.0 output, use full\n`MAJOR.MINOR.PATCH` tags in Git.\n\nThe implementation package is intentionally internal to this module and is not a\nsupported external API.\nIf reused anyway, create a new `GitSemVer` instance per version lookup\nsnapshot; reusing one instance across repository changes can return stale data\nbecause tag metadata is cached.\n\n### Installing\n\n```sh\n$ go install github.com/linkdata/gitsemver@latest\n```\n\n### Command line parameters\n\n```\nUsage of gitsemver:\n  -debug\n        write debug info to stderr\n  -git string\n        path to Git executable (default \"git\")\n  -gopackage\n        write Go source with PkgName and PkgVersion\n  -incpatch\n        increment the patch level and create a new tag\n  -name string\n        override the Go PkgName, default is to use last portion of module in go.mod\n  -nofetch\n        don't fetch remote tags\n  -nonewline\n        don't print a newline after the output\n  -out string\n        write to file instead of stdout (relative paths are relative to repo)\n```\n\n### Examples\n\n#### Print current version of a git repository\n\n```sh\n$ gitsemver $HOME/myreleasedpackage\nv1.2.3\n```\n\n#### Increment the patch level and push a new lightweight tag to the origin\n\n```sh\n$ gitsemver\nv1.2.3-main.456\n$ gitsemver -incpatch\nv1.2.4\n```\n\n#### Generate a go package file with version information\n\n```go\n//go:generate go run github.com/linkdata/gitsemver@latest -gopackage -out version.gen.go\n```\n\nGenerates a file called `version.gen.go` with contents like\n\n```go\n// Code generated by gitsemver at 2025-02-10 07:47:15 UTC DO NOT EDIT.\n// branch \"mybranch\", build 456\npackage mypackage\n\nconst PkgName = \"mypackage\"\nconst PkgVersion = \"v1.2.3-mybranch.456\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdata%2Fgitsemver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkdata%2Fgitsemver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkdata%2Fgitsemver/lists"}