{"id":18111008,"url":"https://github.com/ingomeyer441/detect-direct-checkins","last_synced_at":"2026-04-26T12:31:54.235Z","repository":{"id":62567799,"uuid":"385565647","full_name":"IngoMeyer441/detect-direct-checkins","owner":"IngoMeyer441","description":"A utility which detects direct checkins on specific branches.","archived":false,"fork":false,"pushed_at":"2022-03-17T12:10:28.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T12:47:17.831Z","etag":null,"topics":["git","merge-commit","pre-commit"],"latest_commit_sha":null,"homepage":"","language":"Python","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/IngoMeyer441.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":"2021-07-13T10:32:43.000Z","updated_at":"2021-07-17T08:39:49.000Z","dependencies_parsed_at":"2022-11-03T17:00:59.419Z","dependency_job_id":null,"html_url":"https://github.com/IngoMeyer441/detect-direct-checkins","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IngoMeyer441%2Fdetect-direct-checkins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IngoMeyer441%2Fdetect-direct-checkins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IngoMeyer441%2Fdetect-direct-checkins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IngoMeyer441%2Fdetect-direct-checkins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IngoMeyer441","download_url":"https://codeload.github.com/IngoMeyer441/detect-direct-checkins/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451626,"owners_count":20940946,"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":["git","merge-commit","pre-commit"],"created_at":"2024-11-01T00:12:48.057Z","updated_at":"2026-04-26T12:31:54.187Z","avatar_url":"https://github.com/IngoMeyer441.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# detect-direct-checkins\n\n## Overview\n\nThe `detect-direct-checkins` utility can be used to detect non-merge commits on given branches in a Git repository. It\ncan be run as a [pre-commit framework](https://pre-commit.com/) hook.\n\n## Example Usage\n\n### Command line tool\n\n`detect-direct-checkins` is available on PyPI for Python 3.5+ and can be installed with `pip`:\n\n```bash\npython3 -m pip install detect-direct-checkins\n```\n\nIf you use Arch Linux or one of its derivatives, you can also install `detect-direct-checkins` from the\n[AUR](https://aur.archlinux.org/packages/python-detect-direct-checkins/):\n\n```bash\nyay -S python-detect-direct-checkins\n```\n\nYou also find self-contained executables for 64-bit Linux distributions and macOS High Sierra and newer on the\n[releases page](https://github.com/IngoMeyer441/detect-direct-checkins/releases/latest). They are created with\n[PyInstaller](http://www.pyinstaller.org) and only require glibc \u003e= 2.17 on Linux (should be fine on any recent\nLinux system).\n\nAfter the installation, switch your working directory to a Git repository you would like to check and run\n\n```bash\ndetect-direct-checkins --branch release --allow-root\n```\n\nto check a branch ``release`` for non-merge commits (but ignore initial root commits without parents).\n\n### Usage as a pre-commit hook\n\nAdd\n\n```yaml\n- repo: https://github.com/IngoMeyer441/detect-direct-checkins\n  rev: 0.1.2\n  hooks:\n  - id: detect-direct-checkins\n  - args: ['--branch=release', '--allow-root']\n```\n\nto your `.pre-commit-config.yaml` to detect direct checkins to a branch `release`. The `--allow-root` switch ignores\nroot commits (initial commits without parents).\n\nThe `--branch` argument can be given multiple times to check more than one branch.\n\nThis check is a `post-commit` check, so make sure to install the pre-commit framework as a `post-commit` hook:\n\n```bash\npre-commit install --hook-type post-commit\n```\n\nI recommend to set `default_stages: ['commit']` in your `.pre-commit-config.yaml`. Otherwise, most checks will run\ntwice (in the `pre-commit` and `post-commit` stage).\n\n**Important note**: Since this is a `post-commit` hook, this check **will not avoid the creation of disallowed\ncommits**. It only tells you that a disallowed commit has been created. However, you can run\n\n```bash\npre-commit run --hook-type post-commit\n```\n\nas part of your CI pipeline to enforce this check. Direct-checkins to protected branches will cause this check to fail\nin a CI job.\n\n## Options\n\nThese options are supported:\n\n- `--branch`: Branch which must only contain merge commits, can be given multiple times.\n- `--ignore`: Commit hashes which will be ignored, can be given multiple times\n- `--allow-root`: Allow root commits (commits without parents).\n\n## Contributing\n\nPlease open [an issue on GitHub](https://github.com/IngoMeyer441/detect-direct-checkins/issues/new) if you\nexperience bugs or miss features. Please consider to send a pull request if you can spend time on fixing the issue\nyourself. This project uses [pre-commit](https://pre-commit.com) itself to ensure code quality and a consistent code\nstyle. Run\n\n```bash\nmake git-hooks-install\n```\n\nto install all linters as Git hooks in your local clone of `detect-direct-checkins`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingomeyer441%2Fdetect-direct-checkins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fingomeyer441%2Fdetect-direct-checkins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingomeyer441%2Fdetect-direct-checkins/lists"}