{"id":38792840,"url":"https://github.com/troykinsella/git-lint","last_synced_at":"2026-01-17T12:40:05.093Z","repository":{"id":64302026,"uuid":"191450273","full_name":"troykinsella/git-lint","owner":"troykinsella","description":"A linter for enforcing git repository rules and conventions","archived":false,"fork":false,"pushed_at":"2019-06-17T15:56:08.000Z","size":29,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-20T19:18:27.498Z","etag":null,"topics":["branch","checker","git","lint","linter","tags"],"latest_commit_sha":null,"homepage":null,"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/troykinsella.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}},"created_at":"2019-06-11T21:12:32.000Z","updated_at":"2024-06-20T19:18:27.499Z","dependencies_parsed_at":"2023-01-15T09:31:05.003Z","dependency_job_id":null,"html_url":"https://github.com/troykinsella/git-lint","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/troykinsella/git-lint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troykinsella%2Fgit-lint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troykinsella%2Fgit-lint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troykinsella%2Fgit-lint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troykinsella%2Fgit-lint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/troykinsella","download_url":"https://codeload.github.com/troykinsella/git-lint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troykinsella%2Fgit-lint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["branch","checker","git","lint","linter","tags"],"created_at":"2026-01-17T12:40:04.795Z","updated_at":"2026-01-17T12:40:05.023Z","avatar_url":"https://github.com/troykinsella.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-lint\nA linter for enforcing git repository rules and conventions.\n\n## Installation\n\nCheckout [releases](https://github.com/troykinsella/git-lint/releases) and download the appropriate binary for your system.\nPut the binary in a convenient place, such as `/usr/local/bin/git-lint`.\n\nOr, run the handy dandy install script:\n(Note: go read the script and understand what you're running before trusting it)\n```bash\nexport PREFIX=~ # install into ~/bin\nwget -q -O - https://raw.githubusercontent.com/troykinsella/git-lint/master/install.sh | bash\n```\n\nOr, run these commands to download and install:\n```bash\nVERSION=0.0.1\nOS=darwin # or linux\ncurl -SL -o /usr/local/bin/git-lint https://github.com/troykinsella/git-lint/releases/download/v${VERSION}/git-lint_${OS}_amd64\nchmod +x /usr/local/bin/git-lint\n```\n\nOr, for [Go lang](https://golang.org/doc/code.html) projects, from your `GOPATH`:\n```bash\ngo get github.com/troykinsella/git-lint\n```\n\nLastly, test the installation:\n```bash\ngit-lint -h\n```\n\n## Usage\n\n### Requirements\n\nAs `git-lint` uses [src-d/go-git](https://github.com/src-d/go-git),\nit does not rely on `git` being installed.\n\n### Configuration\n\nAs the kinds of rules that this linter enforces, unlike most other linters,\nare not based on best practices or basic prevention of common errors, but are\nbased on organization-/project-specific rules, NO checks are performed by default.\n`git-lint` must be told what you want it to enforce by activating checks in a \nconfiguration file.  \n\nThe configuration file is in YAML, and defaults to the path `.git-lint.yml`,\nalthough an alternate path can be specified by passing `-c` (or `--config`) to\n`git-lint`.\n\n### Configuration File Format\n\n```yaml\n# .git-lint.yml\nrules:\n  \u003crule-name\u003e:\n    \u003crule-options\u003e\n```\n\n### Full Configuration Example\n\n```yaml\n# .git-lint.yml\nrules:\n  branch_count:\n    max: 100\n    warn: true\n  branch_last_commit:\n    max_duration: 3M\n  branch_name:\n    allow: true\n    patterns:\n    - master\n    - develop\n    - feature/.*\n    - release/v.*\n  branch_singleton:\n    singletons:\n    - release/v.*\n  git_ignore:\n    entries:\n    - tmp\n  git_keep:\n    directories:\n    - bin\n  tag_name:\n    allow: true\n    patterns:\n    - v.*\n```\n\n### Common Rule Options\n\n* `warn`: Optional. Boolean. Default: `false`. When set to `true` \n  and when the rule check fails, the overall `git-lint` execution\n  will not be failed due to this check. Instead, only warning \n  messages will be emitted.\n\n### Time Duration Strings\n\n`git-lint` uses [sloppy_duration](https://github.com/troykinsella/sloppy-duration)\nfor parsing strings that represent time durations.\nIt's \"sloppy\" because it sacrifices precision for conciseness. For example,\nthe amount of time in a month depends on the month, but `sloppy_duration` \ntakes a close-enough guess by using \"one year / 12\".\n\nHere's a summary of supported syntax:\n\n| Example value | Meaning |\n| ------------- | ------- |\n| 2s            | 2 seconds |\n| 5m            | 5 minutes |\n| 10h           | 10 hours |\n| 3d            | 3 days (3 x 24 hours) |\n| 2w            | 2 weeks (14 x 1 day) |\n| 6M            | 6 months (1 year / 2) |\n| 1y            | 1 year (365 days) |\n\n### Running `git-lint`\n\n`git-lint` operates on a locally cloned repository directory.\nRun it like so:\n\n```bash\ngit clone git@github.com/some/repo.git\ncd repo\ngit-lint\n```\n\n### Running `git-lint` with Docker\n\n```bash\ndocker pull troykinsella/git-lint\n\ngit clone git@github.com/some/repo.git\ncd repo\n\ndocker run -it --rm -v $PWD:/repo -w /repo troykinsella/git-lint git-lint\n```\n\n### Rules\n\n#### `GL001` - `branch_count`\n\nEnsures a maximum number of permitted branches in a repository.\n\nOptions:\n* `max`: Required. Integer. The maximum number of branches to allow.\n\nExample:\n```yaml\nrules:\n  branch_count:\n    max: 100\n```\n\n#### `GL002` - `branch_last_commit`\n\nFails when the last commit for a branch is older than a specified time duration.\n\nOptions:\n* `max_duration`: Required. String. A time duration string that \n  defines the maximum time span that can elapse since the last commit. \n\nExample:\n```yaml\n# Fail when a branch hasn't been updated in the last 6 months\nrules:\n  branch_last_commit:\n    max_duration: 6M\n```\n\n#### `GL003` - `branch_name`\n\nSpecifies a whitelist or a blacklist of acceptable branch name patterns.\n\nOptions:\n* `allow`: Optional. Boolean. Default: `false`. When `true`, allow only the\n  specified branch name patterns to exist, and when `false` disallow\n  the specified branch name patterns.\n* `patterns`: Required. List of regular expressions that match branch names.\n\nExample:\n```yaml\n# Fail a branch called \"feechure-BUG-32\", for example\nrules:\n  branch_name:\n    allow: true\n    patterns:\n    - master\n    - develop\n    - feature/.*\n    - release/v.*\n```\n\n#### `GL004` - `branch_singleton`\n\nEnsure there is only one of a given branch name for each of the specified patterns.\n\nOptions:\n* `singletons`: Required. List of regular expressions that match branch names.\n  When more than one match is found, the rule fails.\n\nExample:\n```yaml\n# Ensure there is only one release/* branch at a time.\nrules:\n  branch_singleton:\n    singletons:\n    - release/v.*\n```\n\n#### `GL005` - `git_ignore`\n\nEnsure `.gitignore` entries exist.\n\nOptions:\n* `entries`: Required. A list of strings, which are required to appear\n  in `.gitignore`.\n\nExample:\n```yaml\nrules:\n  git_ignore:\n    entries:\n    - tmp\n```\n\n#### `GL006` - `git_keep`\n\nEnsure a directory is kept by git, whether by containing a `.gitkeep`-like\nfile, or by simply being populated with files.\n\nOptions:\n* `directories`: Required. A list of directories that should exist.\n\nExample:\n```yaml\nrules:\n  git_keep:\n    directories:\n    - bin\n```\n\n#### `GL007` - `tag_name`\n\nSpecifies a whitelist or a blacklist of acceptable tag name patterns.\n\nOptions:\n* `allow`: Optional. Boolean. Default: `false`. When `true`, allow only the\n  specified tag name patterns to exist, and when `false` disallow\n  the specified tag name patterns.\n* `patterns`: Required. List of regular expressions that match tag names.\n\nExample:\n```yaml\n# Fail a tag called \"1.2.3\", for example, demanding a \"v\" prefix\nrules:\n  tag_name:\n    allow: true\n    patterns:\n    - v.*\n```\n\n## License\n\nMIT © Troy Kinsella\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroykinsella%2Fgit-lint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftroykinsella%2Fgit-lint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroykinsella%2Fgit-lint/lists"}