{"id":42369601,"url":"https://github.com/devinrhode2/git-blame-ignore-style-formatting-post-commit-hook","last_synced_at":"2026-01-27T19:18:10.062Z","repository":{"id":61836441,"uuid":"554973574","full_name":"devinrhode2/git-blame-ignore-style-formatting-post-commit-hook","owner":"devinrhode2","description":"Automatically git-blame-ignore style commits: A post-commit hook to add an entry to .git-blame-ignore-revs for `style: foo` commits","archived":false,"fork":false,"pushed_at":"2023-02-16T19:22:10.000Z","size":28,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-02T04:09:56.519Z","etag":null,"topics":["git","git-hooks","git-rebase","post-commit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/devinrhode2.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":"2022-10-20T18:18:54.000Z","updated_at":"2025-03-09T05:40:18.000Z","dependencies_parsed_at":"2023-01-30T17:16:24.314Z","dependency_job_id":null,"html_url":"https://github.com/devinrhode2/git-blame-ignore-style-formatting-post-commit-hook","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devinrhode2/git-blame-ignore-style-formatting-post-commit-hook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devinrhode2","download_url":"https://codeload.github.com/devinrhode2/git-blame-ignore-style-formatting-post-commit-hook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28819185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"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":["git","git-hooks","git-rebase","post-commit"],"created_at":"2026-01-27T19:18:09.277Z","updated_at":"2026-01-27T19:18:10.053Z","avatar_url":"https://github.com/devinrhode2.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automatically git-blame-ignore style tweaks\n\n[![.github/workflows/github-actions.yml](https://github.com/devinrhode2/git-blame-ignore-style-formatting-post-commit-hook/actions/workflows/github-actions.yml/badge.svg)](https://github.com/devinrhode2/git-blame-ignore-style-formatting-post-commit-hook/actions/workflows/github-actions.yml)\n\n## A post-commit hook to add an entry to .git-blame-ignore-revs for pure formatting commits\n\nNow you can upgrade to prettier v2 without ruining git blame!\n\nPRs with changes to `.git-blame-ignore-revs` cannot squash+merge,\notherwise you'll have to add more entries to `.git-blame-ignore-revs` in a follow up PR/commit.\n\n### What does it do, how does it work?\n\nWhen you make a commit like this:\n\n```\nstyle(homepage): Sort imports\n```\n\nThis post-commit hook will automatically add another commit like so:\n\n```\nchore(git-blame): Ignore previous style change\n```\n\n\u003csub\u003eCommit message may be customized in a future version to be: `chore(git-blame): Ignore \"Sort imports\"`\u003c/sub\u003e\n\nYou do NOT need to use commitlint or commitizen to use this hook.\nIt simply looks for commit messages starting with `style: foo`.\n(And probably also `style(foo): bar`, but that may come in a future version)\n\n## Setup\n\n```\nnpm install git-blame-ignore-style-formatting-post-commit-hook --save-dev\n```\n\n```\nyarn add git-blame-ignore-style-formatting-post-commit-hook --dev\n```\n\nIf you are using husky (recommended), create hook like so:\n\n```sh\nmkdir .husky\nmv .husky/post-commit .husky/old-post-commit;\nrm .husky/post-commit\nnpx husky add .husky/post-commit 'GIT_ROOT=\"$(git rev-parse --show-toplevel)\"';\nnpx husky add .husky/post-commit '$GIT_ROOT/node_modules/.bin/git-blame-ignore-style-formatting-post-commit-hook';\nnpx husky add .husky/post-commit '# Directly invoking module is faster than `yarn run git-blame-ignore-style-formatting-post-commit-hook`';\nnpx husky add .husky/post-commit \"# (which makes sense, because it's skipping yarn\\!)\";\n```\n\nIf not using husky, you can use this shell script as a starting point:\n\n```sh\nHOOKS_PATH=\".git-hooks\"\ngit config core.hooksPath $HOOKS_PATH\nmkdir $HOOKS_PATH;\nmv $HOOKS_PATH/post-commit $HOOKS_PATH/old-post-commit;\nrm $HOOKS_PATH/post-commit\ntouch $HOOKS_PATH/post-commit;\nchmod +x $HOOKS_PATH/post-commit;\necho '#!/usr/bin/env sh' \u003e\u003e $HOOKS_PATH/post-commit;\necho 'GIT_ROOT=\"$(git rev-parse --show-toplevel)\"' \u003e\u003e $HOOKS_PATH/post-commit;\necho '' \u003e\u003e $HOOKS_PATH/post-commit;\necho '$GIT_ROOT/node_modules/.bin/git-blame-ignore-style-formatting-post-commit-hook' \u003e\u003e $HOOKS_PATH/post-commit;\necho '# Directly invoking module is faster than `yarn run git-blame-ignore-style-formatting-post-commit-hook`' \u003e\u003e $HOOKS_PATH/post-commit;\necho \"# (which makes sense, because it's skipping yarn\\!)\" \u003e\u003e $HOOKS_PATH/post-commit;\n```\n\nIf you don't already have a `.git-blame-ignore-revs`, one will be created for you before this script attempts to write to it:\n\n```\nCreated empty .git-blame-ignore-revs file, and preinstall script to configure git to use it.\n```\n\nWhen you make a `style: ` commit, it will now show something like this after you commit:\n\n```\nAdding .git-blame-ignore-revs entry for last commit. Reason: Starts with \"style:\"\n```\n\nWhen/if you are rebasing, and need to refresh the sha, you can simply `reword` your `style: ` commits to re-run the `post-commit` hook:\n\n```diff\n// git-rebase-todo\n-pick 7713c93 style: cleanup comments\n-pick c2d2cf6 chore(git-blame): Ignore previous style change\n+reword 7713c93 style: cleanup comments\n+drop c2d2cf6 chore(git-blame): Ignore previous style change\n```\n\nIt's also totally ok to wait till changes are merged to master/main before adding commit sha's to `.git-blame-ignore-revs`. This way, you don't have to worry about refreshing the sha when your mass cleanup commit sha changes. However, the goal of this git hook IS to automatically add entries to `.git-blame-ignore-revs` for you.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevinrhode2%2Fgit-blame-ignore-style-formatting-post-commit-hook/lists"}