{"id":18397481,"url":"https://github.com/avast/git-depth","last_synced_at":"2026-04-25T23:34:59.054Z","repository":{"id":68856219,"uuid":"275114747","full_name":"avast/git-depth","owner":"avast","description":"Compute depths of git revision graphs and use them as build numbers","archived":false,"fork":false,"pushed_at":"2022-03-29T15:44:02.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T17:02:44.274Z","etag":null,"topics":["build-automation","git","version-number"],"latest_commit_sha":null,"homepage":"","language":"C++","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/avast.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":"2020-06-26T09:02:13.000Z","updated_at":"2022-03-25T15:13:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"e64ef0fa-9db8-4124-a4d6-22047b47cacb","html_url":"https://github.com/avast/git-depth","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/avast%2Fgit-depth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avast%2Fgit-depth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avast%2Fgit-depth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avast%2Fgit-depth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avast","download_url":"https://codeload.github.com/avast/git-depth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248586233,"owners_count":21128997,"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":["build-automation","git","version-number"],"created_at":"2024-11-06T02:17:21.568Z","updated_at":"2026-04-25T23:34:59.020Z","avatar_url":"https://github.com/avast.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-depth\n\nComputes depths of git revision graphs\n\n## Motivation\n\nIn the days of Subversion, it was easy to derive version numbers from the Subversion revision number.\nEver since distributed version control became the norm, this is no longer possible.\nInstead, a mechanism external to version control is typically used to allocate version numbers,\nwhich makes builds irreproducible. \n\nThis project proposes a different approach: the build number is derived from\nthe structure of the git commit graph. Therefore, repeated builds starting at the same\ncommit derive the same version number.\n\nWe guarantee that walking along a branch will produce strictly increasing\nnumbers, except when one of the user-specified files change.\nIn that case the version number resets.\n\nTypically, this file will be a `VERSION` file containing the current major and minor version numbers.\nThe result of `git-depth` can then be used as a patch number\nand appended to the contents of this file to produce a complete version.\nIncrementing major or minor version will automatically reset patch to zero.\n\n## Getting Started\n\n1. Download binaries from [releases][1] and place them somewhere in your path.\n2. Create your version file.\n\n       $ echo 1.0 \u003eVERSION\n       $ git add VERSION\n       $ git commit -m \"Add VERSION file\"\n\n3. Use `git-depth` to calculate the version patch number.\n\n       $ git-depth HEAD VERSION\n       0\n\n4. You can also automatically prepend the contents of the VERSION file.\n\n       $ git-depth -c HEAD VERSION\n       1.0.0\n    \n4. Add more commits.\n\n       $ echo fix \u003e\u003efile.txt\n       $ git commit -am \"Fixes to file.txt\"\n       $ git-depth -c HEAD VERSION\n       1.0.1\n       $ echo the previous fix did not work \u003e\u003efile.txt\n       $ git commit -am \"More fixes to file.txt\"\n       $ git-depth -c HEAD VERSION\n       1.0.2\n    \n5. Increase the minor version and observe the patch number reset.\n\n       $ echo 1.1 \u003eVERSION\n       $ git commit -am \"Bump version to 1.1\"\n       $ git-depth -c HEAD VERSION\n       1.1.0\n\n## License\n\nThe project itself is licensed under the MIT license.\nHowever, the released binaries embed libgit2, which is licensed under GPL,\nand as such the binary releases are licensed as GPL a well.\n\n  [1]: https://github.com/avast/git-depth/releases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favast%2Fgit-depth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favast%2Fgit-depth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favast%2Fgit-depth/lists"}